Problem
Given a string word, write a function solution that returns the number of vowels ("a", "e", "i", "o", "u") in the string.
Constraints
wordconsists only of lowercase English letters.- The length of
wordis between 1 and 100 inclusive.
Test Case
| Test Case Number | word | return |
|---|---|---|
| 1 | "hello" | 2 |
| 2 | "algorithm" | 3 |
| 3 | "sky" | 0 |
Explanation for Test Case 1
- When
word = "hello", the vowels are"e"and"o", totaling 2, so the return value is2.
Explanation for Test Case 2
- When
word = "algorithm", the vowels are"a","o", and"i", totaling 3, so the return value is3.
Explanation for Test Case 3
- When
word = "sky", there are no vowels, so the return value is0.