Все задачи
Легко Решено: 0 Процент решений: 0%

Count Uppercase Letters

Count the capital letters in a text.

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

Учитесь у других

Решения сообщества

Пока нет опубликованных решений. Решите задание, чтобы поделиться первым.