226. Count the Vowels
Foundation1000 ms256 MBSolved by 0%
Print how many vowels the string contains. Vowels are a, e, i, o
and u, in either case.
Recursively: the count for a string is 1 or 0 for its first character, plus the count for the rest.
Uppercase counts. Convert the character to lowercase before testing it, or handle both cases in the comparison.
Constraints - `1 ≤ length of s ≤ 200000`
Input
A single line containing a string s, made of letters with no spaces.
Output
Print one integer, the number of vowels in s.
Inputhello
Output2
Notehas two vowels among five letters
Inputxyz
Output0
Notehas none, so the answer is 0 rather than an error
Hints
Four rungs, in order. The last two open once you have submitted an attempt — a wrong one counts.
Hint 1Where to start
Hint 2The approachOpen hint 1 first — this one carries on from it.
Hint 3PseudocodeOpen hint 2 first — this one carries on from it.
Hint 4Full solutionOpen hint 3 first — this one carries on from it.