問題
翻訳を表示Count 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.
制約
0 ≤ length ≤ 10,000
例
例 1
入力:
text = "Hello World"
期待される出力:
expected = 3
入力:
std::string text = "Hello World";
期待される出力:
long long expected = 3;
入力:
string text = "Hello World";
期待される出力:
long expected = 3;
解説
e, o and o are vowels: 3.
例 2
入力:
text = "AEIOU and y"
期待される出力:
expected = 6
入力:
std::string text = "AEIOU and y";
期待される出力:
long long expected = 6;
入力:
string text = "AEIOU and y";
期待される出力:
long expected = 6;
解説
A, E, I, O, U, a are vowels; y is not counted: 6.
参考資料
この課題はCodeUtility用に調整されています。上記の説明と制約に従ってください。