#P7180. [BalticOI 2004] Repeats (Day2)
[BalticOI 2004] Repeats (Day2)
Description
If a string satisfies:
- For a pair of numbers .
- is formed by concatenating copies of a string of length .
Then is called a string.
For example, is a string with .
Given a string (containing only characters and ), you need to find a contiguous substring of that is a string, such that is as large as possible.
For example, , where the underlined part is a string, and in this case is maximized.
Input Format
The first line contains an integer , representing the length of .
The next lines each contain one character ( or ), describing the string.
Output Format
The first line contains a number .
The second line contains a number .
The third line contains a number , representing the starting position of this substring (positions start from ).
If there are multiple valid answers, output any one of them.
17
b
a
b
b
a
b
a
a
b
a
a
b
a
a
b
a
b
4
3
5
Hint
Constraints
For of the testdata, , .
Notes
Translated from BalticOI 2004 Day2 A Repeats.
Special thanks to
Translated by ChatGPT 5
京公网安备 11011102002149号