Sixth Sence
Very hard
Execution time limit is 2 seconds
Runtime memory usage limit is 256 megabytes
A string is sent down to you from Heaven. Intuition says that it contains palindromes as substrings. Subconscious whispers that you must find the longest intersection of that palindromes. Conscience is sure that you dont need such intersections when one palindrome is entirely contained inside another.
Justice reminds you that palindrome is a string, that is read equally from left to right and from right to left. But Pride states that it is enough to find the longest intersection.
Input
Input contains a string of latin letters of maximal length 1000000.
Output
Output the length of the longest intersection of substrings-palindromes. If there are no such intersections, output 0.
Examples
Input #1
Answer #1
Submissions 12