Тема: timus 1761
Let an integer n be given. Write the integers from 1 to n in binary notation successively from left to right. In the resulting string consisting of zeros and ones, choose a palindrome substring of maximal length. It is required to find the length of this substring.
Input
The only input line contains the integer n in binary notation (1 ? n ? 2^1 000 000).
Output
Output one line containing the required length.
Samples
input output
101 5
10100 11
Hint
In the first sample, the string 11011100101 will be written (a variant of the longest palindrome is underlined).
Nereal'naya zadacha na vid, esli chto http://acm.timus.ru/problem.aspx?space=1&num=1761