Problem
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.
Einschränkungen
0 ≤ length of text ≤ 10,000 (ASCII characters)
Beispiele
Beispiel 1
Eingabe:
text = "Hello World"
Erwartete Ausgabe:
expected = 2
Eingabe:
std::string text = "Hello World";
Erwartete Ausgabe:
long long expected = 2;
Eingabe:
string text = "Hello World";
Erwartete Ausgabe:
long expected = 2;
Erläuterung
H and W are uppercase: 2.
Beispiel 2
Eingabe:
text = "no caps here!"
Erwartete Ausgabe:
expected = 0
Eingabe:
std::string text = "no caps here!";
Erwartete Ausgabe:
long long expected = 0;
Eingabe:
string text = "no caps here!";
Erwartete Ausgabe:
long expected = 0;
Erläuterung
There are no uppercase letters: 0.
Referenzen
Diese Aufgabe wurde für CodeUtility angepasst. Beachte die oben genannten Vorgaben und Einschränkungen.