Count Vowels and Consonants
EasyP3Coding
s is a string of lowercase letters. Return [vowels, consonants]: the number of characters that are a, e, i, o or u, and the number of all other characters.
Example 1
- Input
- s = "hello"
- Output
- [2,3]
Example 2
- Input
- s = "aeiou"
- Output
- [5,0]
Example 3
- Input
- s = "xyz"
- Output
- [0,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.