Условие
Показать перевод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. Следуйте условию и ограничениям выше.