Count Consonants (Set 5)

Easy

Given a lowercase string text, return how many characters are consonants — every letter that is not a vowel.

Count Consonants (Set 5) — the data. This set runs 4 cases: text is a string of 39–47 characters. The hidden cases are the largest of the set.

Example 1

countConsonants()
Input
text = "olnsbaeshkgyxdqinclchhoopkekeicekjplewnmcbijovj"
Output
34

Why

`countConsonants` returns `34` for this input.

Example 2

countConsonants()
Input
text = "rthmvvncapcrwsorepyuakmnnhzrwprcbjutodqsvmac"
Output
36

Why

`countConsonants` returns `36` for this input.
Constraints
0 <= text.length <= 10^5
`text` contains lowercase letters only.
Every case in this set must pass: the first two are visible on Run, the last two unlock on Submit.

Topics

StringsCounting

Implement countConsonants in the editor and return the answer — printing it is never graded.