Consider a word w
consisting of n
symbols. We can decompose
it at point i
(1 ≤ i
− 1) into a prefix p
of length i
and a suffix s
of length n
. Local root
of a word w
at point i
is a non-empty word r
- p is a suffix of r, or r is a suffix of p, or r is equal to p;
- s is a prefix of r, or r is a prefix of s, or r is equal to s;
- r has minimal possible length.
Your goal is to find such a point that the length of local root at this point is maximal possible.
The only line contains a word w consisting of lowercase English letters. Its length is at least two and at most 300 000 symbols.
Output the required point of decomposition and the length of local root at this point. If there are several possible answers,
output any of them.
Local roots of a word “aababaaa” at different points:
Problem Author: Ivan Burmistrov
Problem Source: Ural SU Contest. Petrozavodsk Summer Session, August 2010