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.
Constraints
0 ≤ length of text ≤ 10,000 (ASCII characters)
Examples
Example 1
Input:
text = "Hello World"
Expected output:
expected = 2
Input:
std::string text = "Hello World";
Expected output:
long long expected = 2;
Input:
string text = "Hello World";
Expected output:
long expected = 2;
Explanation
H and W are uppercase: 2.
Example 2
Input:
text = "no caps here!"
Expected output:
expected = 0
Input:
std::string text = "no caps here!";
Expected output:
long long expected = 0;
Input:
string text = "no caps here!";
Expected output:
long expected = 0;
Explanation
There are no uppercase letters: 0.
References
This challenge is adapted for CodeUtility. Follow the statement and constraints above.