Problème
Afficher la traductionCount how many characters in text are vowels: a, e, i, o, u in either uppercase or lowercase.
Implement count_vowels(text).
Input
text: The text to inspect (ASCII characters).
Output
Return the number of vowels.
Contraintes
0 ≤ length ≤ 10,000
Exemples
Exemple 1
Entrée :
text = "Hello World"
Sortie attendue :
expected = 3
Entrée :
std::string text = "Hello World";
Sortie attendue :
long long expected = 3;
Entrée :
string text = "Hello World";
Sortie attendue :
long expected = 3;
Explication
e, o and o are vowels: 3.
Exemple 2
Entrée :
text = "AEIOU and y"
Sortie attendue :
expected = 6
Entrée :
std::string text = "AEIOU and y";
Sortie attendue :
long long expected = 6;
Entrée :
string text = "AEIOU and y";
Sortie attendue :
long expected = 6;
Explication
A, E, I, O, U, a are vowels; y is not counted: 6.
Références
Ce défi a été adapté pour CodeUtility. Suivez l'énoncé et les contraintes ci-dessus.