You are given a string S made only of digits. A contiguous substring of S 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 S.
For example, when S = 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 S = 6789789 the longest kri string is 789789, and when S = 6789678 the longest kri string is 9678.
The first line contains the string S. S consists of digits only and its length is at most 1,000. Every input contains at least one kri string.
Print the length of the longest kri string in S on the first line.