Count how many vowels a string contains. Vowels are a, e, i, o, u, in either upper or lower case.
Input
A single line containing the string s.
Output
A single integer: the number of vowels in s.
Count how many vowels a string contains. Vowels are a, e, i, o, u, in either upper or lower case.
A single line containing the string s.
A single integer: the number of vowels in s.
Example 1
hello
2
e and o are vowels — 2.
Example 2
sky
0
No vowels — 0.
Example 3
AEIOU
5
Upper-case vowels count too — 5.
Walk through each character and check whether it is one of the ten vowel characters (five letters in two cases).
Put the vowels in a set/string like "aeiouAEIOU" and count characters that belong to it.
Iterate over the characters and count those that appear in the vowel set (both cases).
s = input()
print(sum(1 for c in s if c in "aeiouAEIOU"))
Tell us what needs to change, who it affects and any important deadline. We will review the context and reply with useful next questions.