vowels
containing all vowel characters: 'a', 'e', 'i', 'o', 'u'.max_vowels
to 0, which will hold the maximum number of vowels found in any substring of length k
.current_vowels
to 0, which will hold the number of vowels in the current window.k
characters of s
and increment current_vowels
for each vowel encountered.max_vowels
to current_vowels
as the initial maximum.s
starting from the k
-th character to the end:
s[i]
) is a vowel, increment current_vowels
.s[i - k]
) is a vowel, decrement current_vowels
.max_vowels
with the maximum of max_vowels
and current_vowels
.max_vowels
as the result.