Problema
Mostra traduzioneCount 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.
Vincoli
0 ≤ length of text ≤ 10,000 (ASCII characters)
Esempi
Esempio 1
Input:
text = "Hello World"
Output atteso:
expected = 2
Input:
std::string text = "Hello World";
Output atteso:
long long expected = 2;
Input:
string text = "Hello World";
Output atteso:
long expected = 2;
Spiegazione
H and W are uppercase: 2.
Esempio 2
Input:
text = "no caps here!"
Output atteso:
expected = 0
Input:
std::string text = "no caps here!";
Output atteso:
long long expected = 0;
Input:
string text = "no caps here!";
Output atteso:
long expected = 0;
Spiegazione
There are no uppercase letters: 0.
Riferimenti
Questa sfida è adattata per CodeUtility. Segui la traccia e i vincoli sopra.