Given a string word
and a non-negative integer k
, return the total number of substrings of word
that satisfy both of the following conditions:
k
consonants.The task is to count all contiguous substrings of the input string word
that:
a
, e
, i
, o
, and u
.k
consonants (letters that are not vowels).5 <= word.length <= 2 * 10^5
word
consists only of lowercase English letters.0 <= k <= word.length - 5
word = "cuaeio"
, k = 1
"cuaeio"
. It contains all vowels (u
, a
, e
, i
, o
) and exactly 1 consonant (c
).1
word = "aeioubt"
, k = 2
"aeioubt"
has all vowels and exactly 2 consonants (b
and t
). No other substring meets the criteria.1
word = "abaeiou"
, k = 1
"baeiou"
(from index 1 to 6) contains vowels (a
, e
, i
, o
, u
) and 1 consonant (b
)."abaeiou"
(from index 0 to 6) also contains all vowels and exactly 1 consonant (b
).2
word
consists only of lowercase English letters.Loading component...
Loading component...