Baltic Olympiad in Informatics: 2004 Day 2, Problem 1
A string abaabaabaaba
is a aba
as the seed string. That is, the seed string aba
is
You are given a string
Constraints
a
or b
.
Input Specification
The first line of input contains one integer
The next a
or b
).
Output Specification
Output three integers, each on its own line. They report the
- The first line consists of the repeat count
that is maximized. - The second line consists of the length
of the seed string that is repeated times. - The third and final line consists of the position
at which the -repeat starts.
If there are multiple solutions with the same
Sample Input
17
b
a
b
b
a
b
a
a
b
a
a
b
a
a
b
a
b
Sample Output
4
3
5
Sample Explanation
A
The underlined substring
Comments