text of lowercase English letters.
Find the longest contiguous piece of text in which each of the vowels a, e, i, o, u appears an even number of times (zero times counts as even). Consonants may appear any number of times.
Return the length of that piece. The empty piece always qualifies, so the answer is at least 0.text="bananas" → 5
The whole string has three a's, an odd count. The pieces "banan" and "nanas" contain two a's each and have length 5; nothing longer works.
text="rhythm" → 6
There are no vowels at all, and zero is even, so the whole string works.
text="aeiou" → 0
Every non-empty piece contains some vowel exactly once. Only the empty piece qualifies, so the answer is 0.
text consists of lowercase English letterstext="bananas"
5
Run checks the first 3 tests in your browser. Submit checks all 79 tests on the server, hidden ones included.