#C3747. Longest Vowel Subsequence

    ID: 47208 Type: Default 1000ms 256MiB

Longest Vowel Subsequence

Longest Vowel Subsequence

Given a string S consisting only of lowercase English letters, find the length of the longest subsequence of S that contains only vowels. Note that a subsequence is a sequence that can be derived from the string by deleting some or no elements without changing the order of the remaining elements. Since vowels can be chosen in any order that appears in S, this task simply amounts to counting the total number of vowels in S.

The vowels are defined as: \(\{a, e, i, o, u\}\). Thus, the answer for a string \(S\) of length \(n\) is computed as:

\(\text{result} = \sum_{i=1}^{n} f(s_i)\)

where \(f(s_i) = 1\) if \(s_i\) is a vowel and \(f(s_i) = 0\) otherwise.

inputFormat

The input is read from standard input (stdin). The first line contains a single integer T representing the number of test cases. This is followed by T lines, each containing a non-empty string S composed only of lowercase letters.

Example:

3
 aeiou
 abecidofu
 xyz

outputFormat

For each test case, output one line containing a single integer, which is the length of the longest subsequence consisting of only vowels in the respective string.

Example:

5
5
0
## sample
3
aeiou
abecidofu
xyz
5

5 0

</p>