ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules

1842. Local Roots

Time limit: 0.5 second
Memory limit: 64 MB
Consider a word w consisting of n symbols. We can decompose it at point i (1 ≤ in − 1) into a prefix p of length i and a suffix s of length ni. Local root of a word w at point i is a non-empty word r such that:
  • 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.

Input

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

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.

Sample

inputoutput
aababaaa
5 6

Notes

Local roots of a word “aababaaa” at different points:
Point 1 2 3 4 5 6 7
Local root a babaa ab ba aaabab a a
Problem Author: Ivan Burmistrov
Problem Source: Ural SU Contest. Petrozavodsk Summer Session, August 2010