Kri String

No attempts yetTime limit1sMemory limit256 MB

Problem

You are given a string SS made only of digits. A contiguous substring of SS is a kri string when its length is even and the digits in its first half sum to the same value as the digits in its second half. The empty string is not a kri string.

Write a program that finds the longest kri string in SS.

For example, when SS = 67896789 the whole string is a kri string, because the first half 6789 sums to 30 and the second half 6789 also sums to 30. When SS = 6789789 the longest kri string is 789789, and when SS = 6789678 the longest kri string is 9678.

Input

The first line contains the string SS. SS consists of digits only and its length is at most 1,000. Every input contains at least one kri string.

Output

Print the length of the longest kri string in SS on the first line.