समस्या
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 के लिए अनुकूलित की गई है। ऊपर दिए गए स्टेटमेंट और सीमाओं का पालन करें।