Problem
Übersetzung anzeigenCount 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.
Einschränkungen
0 ≤ length ≤ 10,000
Beispiele
Beispiel 1
Eingabe:
text = "Hello World"
Erwartete Ausgabe:
expected = 3
Eingabe:
std::string text = "Hello World";
Erwartete Ausgabe:
long long expected = 3;
Eingabe:
string text = "Hello World";
Erwartete Ausgabe:
long expected = 3;
Erläuterung
e, o and o are vowels: 3.
Beispiel 2
Eingabe:
text = "AEIOU and y"
Erwartete Ausgabe:
expected = 6
Eingabe:
std::string text = "AEIOU and y";
Erwartete Ausgabe:
long long expected = 6;
Eingabe:
string text = "AEIOU and y";
Erwartete Ausgabe:
long expected = 6;
Erläuterung
A, E, I, O, U, a are vowels; y is not counted: 6.
Referenzen
Diese Aufgabe wurde für CodeUtility angepasst. Beachte die oben genannten Vorgaben und Einschränkungen.