text written in lowercase English letters with no spaces. They care about contiguous fragments that contain each of the vowels a, e, i, o, u at least once and exactly k consonants. A consonant is any letter other than those five vowels.
Return the number of such fragments. Fragments at different positions count separately, even if their letters match.
The text is long, so checking every fragment will be too slow.text="sequoia", k=1 → 1
Only "equoia" works: all five vowels and the single consonant q. Adding the s makes two consonants.
text="ouiaexe", k=1 → 2
Both substrings start at the first letter: "ouiaex" and "ouiaexe". Each has one consonant, x.
text="taeioutt", k=2 → 2
"taeiout" and "aeioutt", each with exactly two consonants.
text consists of lowercase English letterstext="sequoia", k=1
1
Run checks the first 3 tests in your browser. Submit checks all 71 tests on the server, hidden ones included.