text of lowercase English letters and an integer k.
Count the contiguous substrings of text in which each of the vowels a, e, i, o, u appears at least once and which contain exactly k consonants. Any letter other than those five is a consonant.
Substrings at different positions are counted separately, even if they read the same.text="banaeiou", k=1 → 2
"anaeiou" and "naeiou" both have all five vowels and exactly one consonant, n. The whole string does not count: it has two consonants.
text="aeiouu", k=0 → 2
No consonants and every vowel: "aeiou" and "aeiouu".
text="xaeioy", k=1 → 0
There is no u anywhere, so no piece qualifies.
text consists of lowercase English letterstext="banaeiou", k=1
2
Run checks the first 3 tests in your browser. Submit checks all 70 tests on the server, hidden ones included.