#K88317. Longest Substring with Vowel
Longest Substring with Vowel
Longest Substring with Vowel
Given a string \( S \), find the length of the longest substring of \( S \) that contains at least one vowel. The vowels are defined as \( \{a, e, i, o, u\} \). Notice that if the string contains at least one vowel, the entire string is a valid substring.
Formally, if \( \exists c \in S \) such that \( c \in \{a, e, i, o, u\} \), then the answer is \( |S| \); otherwise, the answer is 0.
inputFormat
The first line of input contains an integer \( T \) representing the number of test cases. Each of the following \( T \) lines contains a single non-empty string \( S \) consisting of lowercase English letters.
outputFormat
For each test case, output a single integer on a new line representing the length of the longest substring of \( S \) that contains at least one vowel.
## sample6
alphabet
rhythm
a
bcdfg
abcde
aaaabaaa
8
0
1
0
5
8
</p>