Menu
CoddyTech

Count Vowels

You get a string s made of English letters. Count how many of its characters are vowels and return that number. 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 the same as a lower case one, so the answer is 4.

lock icon+18 hidden tests on Submit

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 cases

Case 1

Case 2

Input

s = "Interview"

Expected

4