Count Consonants
EasyP3Coding
Return the number of consonants in the lowercase string s: every character that is not a, e, i, o or u.
Example 1
- Input
- s = "hello"
- Output
- 3
Example 2
- Input
- s = "aeiou"
- Output
- 0
Example 3
- Input
- s = "xyz"
- Output
- 3
Constraints
- 0 <= s.length <= 10^5
- s consists of lowercase letters.
Hints
Give it a real attempt first. Run shows which examples fail.
Saved automatically
Run checks the 3 visible tests, Submit all 10. ⌘Enter runs, ⌘⇧Enter submits.