6. Count Vowels
EasyStrings~6 min
Write a function that counts the vowels (a, e, i, o, u) in a string.
The count is case-insensitive: A and a both count.
Examples
Example 1
- Input:
- str = "hello"
- Output:
- 2
- Why:
- e and o
Example 2
- Input:
- str = "RunScript"
- Output:
- 2
- Why:
- u and i
Constraints
0 <= str.length <= 1000y is not treated as a vowel.