Again palindromes#5538

Again palindromes

1 second
64 megabytes
Very easy

Beka became interested in the properties of a sequence created by writing out, in order, all the digits of a given sequence of non-negative integers. As Beka was writing down these digits, Anna noticed that some segments of the resulting digit sequence form palindromes. Recall that a palindrome is a sequence that reads the same forwards and backwards; that is, each symbol equidistant from the ends of the sequence matches.

The children want to find the longest palindrome present in this sequence. Let's help them by writing a program that, given a sequence of non-negative integers, outputs the length of the longest palindrome that appears as a contiguous subsequence in the combined sequence of digits from these numbers.

For example, if the sequence given is 7, 12, 43, 421, 7503, then the sequence of digits is 7, 1, 2, 4, 3, 4, 2, 1, 7, 5, 0, 3. Clearly, the first digits form a palindrome, which is the longest. Therefore, the answer is .

Input

The input contains the numbers of the original sequence. The numbers are separated by spaces and/or newlines. The number of numbers in the original sequence does not exceed . Each number is at least and at most .

Output

Output a single integer — the length of the longest contiguous palindromic subsequence in the combined sequence of digits.

Examples

Example 1

Loading
Loading