Count Vowels, Consonants, Spaces and Special Characters

E · easyP · Verified PYQstrings

Given a string, count and display: - Number of vowels (a,e,i,o,u — case insensitive) - Number of consonants - Number of spaces - Number of special characters

Input
Hello World! 123
Output
Vowels: 3
Consonants: 7
Spaces: 2
Special: 4
Loop through each character. Check: is it in vowel set? is it alpha (consonant)? is it space? else special.
← Count Vowels and ConsonantsCount Words in a String →
Report an issue with this question