Menu
CoddyTech

Count Vowels

Given a string s of English letters, return how many of its characters are vowels. The vowels are a, e, i, o and u, in lower or upper case. The letter y does not count.

Function

countVowels(s: string) → integer
sstring
the string of English letters to scan
Returnsinteger
the number of vowels in s, upper and lower case together

Constraints

  • 1 ≤ s.length ≤ 5 × 104
  • s contains only English letters (a to z, A to Z).

Examples

Input
s = "Interview"
Output
4
Explanation
The vowels are I, e, i and e. The capital I counts like a lower case one, so the answer is 4.
challenge icon

Follow-up

Can you return how many times each of the five vowels appears, still reading the string only once?

Reset code
def countVowels(s):
    # Write code here

Test #1

Test #2

Argument

s = "Interview"

Expected Output

4