Count Vowels, Consonants, Spaces and Special Characters
E · easyP · Verified PYQstrings
Problem
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
Example
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.