#arc059b. [arc059_b]Unbalanced
[arc059_b]Unbalanced
Problem Statement
Given a string , we will call it unbalanced if and only if the length of is at least , and more than half of the letters in are the same. For example, both voodoo
and melee
are unbalanced, while neither noon
nor a
is.
You are given a string consisting of lowercase letters. Determine if there exists a (contiguous) substring of that is unbalanced. If the answer is positive, show a position where such a substring occurs in .
Constraints
- consists of lowercase letters.
Partial Score
- points will be awarded for passing the test set satisfying .
Input
The input is given from Standard Input in the following format:
Output
If there exists no unbalanced substring of , print -1 -1
.
If there exists an unbalanced substring of , let one such substring be , and print $a$ $b$
. If there exists more than one such substring, any of them will be accepted.
Sample Input 1
needed
Sample Output 1
2 5
The string \= eede
is unbalanced. There are also other unbalanced substrings. For example, the output 2 6
will also be accepted.
Sample Input 2
atcoder
Sample Output 2
-1 -1
The string atcoder
contains no unbalanced substring.