#K91382. Longest Equal '2's and '3's Substring

    ID: 37963 Type: Default 1000ms 256MiB

Longest Equal '2's and '3's Substring

Longest Equal '2's and '3's Substring

You are given a string S consisting only of characters '2' and '3'. Your task is to determine the length of the longest contiguous substring in which the number of '2's is equal to the number of '3's.

Example: For S = "2323", the entire string has two '2's and two '3's, so the answer is 4.

Note: If no such substring exists, output 0.

The relation that should be satisfied by a valid substring is given by the equation:

#2#3=0.\#2 - \#3 = 0.

inputFormat

The input is read from stdin and consists of a single line containing the string S (which contains only the characters '2' and '3').

outputFormat

Print one integer to stdout: the length of the longest substring of S that contains an equal number of '2's and '3's.

## sample
2323
4