Given a string s, return how many vowels it has.
The vowels are a, e, i, o and u, in lower case or in upper case. The letter y is not a vowel here. Every other character (consonants, spaces, digits, punctuation) is skipped.
Example 1:
Input: s = "Hello World" Output: 3 Explanation: The vowels are e, o and o. The other characters, the space included, are skipped.
Example 2:
Input: s = "AlgoCademy" Output: 4 Explanation: A, o, a and e are vowels: the upper-case A counts too. The y doesn't count.
Example 3:
Input: s = "Why try?" Output: 0 Explanation: y is not a vowel, so this string has none.
Constraints:
shas at least one character and doesn't start or end with a space.scontains English letters, digits, spaces and punctuation.
Free plan: 30 tutor messages. Premium is unlimited.
Saved
Ctrl + Enter to check
