atcoder#ARC059B. [ARC059D] アンバランス
[ARC059D] アンバランス
Score : points
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.
needed
2 5
The string 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.