Problema
Ver traduçãoCount 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.
Restrições
0 ≤ length of text ≤ 10,000 (ASCII characters)
Exemplos
Exemplo 1
Entrada:
text = "Hello World"
Saída esperada:
expected = 2
Entrada:
std::string text = "Hello World";
Saída esperada:
long long expected = 2;
Entrada:
string text = "Hello World";
Saída esperada:
long expected = 2;
Explicação
H and W are uppercase: 2.
Exemplo 2
Entrada:
text = "no caps here!"
Saída esperada:
expected = 0
Entrada:
std::string text = "no caps here!";
Saída esperada:
long long expected = 0;
Entrada:
string text = "no caps here!";
Saída esperada:
long expected = 0;
Explicação
There are no uppercase letters: 0.
Referências
Este desafio foi adaptado para o CodeUtility. Siga o enunciado e as restrições acima.