#K88862. Longest Even Character Substring

    ID: 37403 Type: Default 1000ms 256MiB

Longest Even Character Substring

Longest Even Character Substring

Given a string s consisting of lowercase English letters, find the length of the longest contiguous substring in which every character appears an even number of times. In other words, for every character c that occurs in the substring, if f(c) represents its frequency, then it must hold that

$$ f(c) \equiv 0 \; (\bmod\; 2) $$

The empty substring is defined to have length 0. Your task is to compute and output the maximum length of such a substring.

inputFormat

The input consists of a single line which contains the string s (1 \leq |s| \leq 10^5), composed only of lowercase English letters.

outputFormat

Output a single integer denoting the length of the longest substring in which every character appears an even number of times.

## sample
abab
4

</p>