問題
Count how many characters in text are uppercase English letters A–Z.
Implement count_uppercase(text).
Input
text: The text to inspect.
Output
Return the number of uppercase letters.
制約
0 ≤ length of text ≤ 10,000 (ASCII characters)
例
例 1
入力:
text = "Hello World"
期待される出力:
expected = 2
入力:
std::string text = "Hello World";
期待される出力:
long long expected = 2;
入力:
string text = "Hello World";
期待される出力:
long expected = 2;
解説
H and W are uppercase: 2.
例 2
入力:
text = "no caps here!"
期待される出力:
expected = 0
入力:
std::string text = "no caps here!";
期待される出力:
long long expected = 0;
入力:
string text = "no caps here!";
期待される出力:
long expected = 0;
解説
There are no uppercase letters: 0.
参考資料
この課題はCodeUtility用に調整されています。上記の説明と制約に従ってください。