atcoder#ARC059B. [ARC059D] アンバランス

[ARC059D] アンバランス

Score : 400400 points

Problem Statement

Given a string tt, we will call it unbalanced if and only if the length of tt is at least 22, and more than half of the letters in tt are the same. For example, both voodoo and melee are unbalanced, while neither noon nor a is.

You are given a string ss consisting of lowercase letters. Determine if there exists a (contiguous) substring of ss that is unbalanced. If the answer is positive, show a position where such a substring occurs in ss.

Constraints

  • 2s1052 \leq |s| \leq 10^5
  • ss consists of lowercase letters.

Partial Score

  • 200200 points will be awarded for passing the test set satisfying 2N1002 \leq N \leq 100.

Input

The input is given from Standard Input in the following format:

ss

Output

If there exists no unbalanced substring of ss, print -1 -1.

If there exists an unbalanced substring of ss, let one such substring be sasa+1...sbs_a s_{a+1} ... s_{b} (1a<bs)(1 \leq a < b \leq |s|), and print a b. If there exists more than one such substring, any of them will be accepted.

needed
2 5

The string s2s3s4s5s_2 s_3 s_4 s_5 == eede is unbalanced. There are also other unbalanced substrings. For example, the output 2 6 will also be accepted.

atcoder
-1 -1

The string atcoder contains no unbalanced substring.