← All problems
Count the Vowels
Easy
1 solved
Count the Vowels
You are given one line of text. Count how many vowels it contains and print that count.
The vowels are a, e, i, o, u in both lowercase and uppercase. Every other character — consonants, digits, spaces, punctuation — is ignored.
The line may contain spaces, so read the whole line, not just one word.
Input
A single line of text S, which may contain spaces.
Output
A single integer: the number of vowels in S.
Constraints
1 <= length of S <= 200
Example 1
Input
Hello World
Output
3
The vowels are e, o and o.
Submit runs your code against 5 test cases — the 1 shown above plus 4 hidden ones covering the awkward cases. Run sample just tries the first example, which is usually what you want while you are still working it out.