PythonEasyStrings10 min
Count vowels and consonants
Treat uppercase and lowercase letters alike. Ignore digits, punctuation and spaces; vowels are a, e, i, o and u. Interviewers use this problem to assess filter English letters before classifying vowels.
Input
One ASCII line.
Output
Print the result values separated by single spaces; print an empty line for an empty result.
Constraints
0 <= length <= 100000.
Example
Input
Hello World!
Output
3 7
Example 2 input
aAa
Output
3 0
Repeated vowels count separately.
Public test cases (2)
Input
Hello World!
Expected output
3 7
Input
AEIOU xyz
Expected output
5 3
Hints (2)
- Identify the state needed to avoid repeated work.
- Filter English letters before classifying vowels.
Target complexity: time O(n) · space O(n) for the lowercase copy
