152. Count Vowels and Consonants

EasyStringString

Given a string s consisting of lowercase and/or uppercase English letters, count the number of vowels (a, e, i, o, u — case-insensitive) and consonants (all other English letters, case-insensitive).

Non-letter characters (digits, spaces, punctuation) should be ignored.

Return the result as two space-separated integers: vowels consonants.

Input: A single string s.

Output: Two space-separated integers: number of vowels and number of consonants.

Examples

Example 1
Input: hello
Output: 2 3
Explanation: Vowels: e, o (2). Consonants: h, l, l (3). Non-letters: none.
Example 2
Input: aeiou
Output: 5 0
Explanation: All 5 characters are vowels. No consonants.
Example 3
Input: rhythm
Output: 0 6
Explanation: 'rhythm' has no vowels and 6 consonants (r, h, y, t, h, m). Note: y is treated as a consonant here.

Constraints

Asked by

TCSInfosysWiproCognizantCapgemini
Solve this problem in the editor →