AlgoLounge

Count Vowels

easy

Given a string, count the number of vowels it contains. Vowels are defined as a, e, i, o, u (both uppercase and lowercase).

Examples

Example 1

Input:  "hello"
Output: 2

Contains 'e' and 'o'

Example 2

Input:  "PROGRAMMING"
Output: 3

Contains 'O', 'A', and 'I'

Constraints

  • Case-insensitive vowel counting
  • String can be empty
TypeScript
Loading editor…
List of test cases (10)
Case 1
s = "hello"
Case 2
s = "PROGRAMMING"
Case 3
s = ""
Case 4
s = "bcdfg"
Case 5
s = "aeiou"
Case 6
s = "AEIOU"
Case 7
s = "The quick brown fox"
Case 8
s = "xyz"
Case 9
s = "Education"
Case 10
s = "rhythm"