题解 | #统计大写字母个数#
统计大写字母个数
https://www.nowcoder.com/practice/434414efe5ea48e5b06ebf2b35434a9c
#include <iostream> using namespace std; int main() { string str; while (getline(cin, str) ) { // 注意 while 处理多个 case int cnt = 0; for(auto it : str){ if(isupper(it)){ cnt++; } } cout << cnt << endl; } } // 64 位输出请用 printf("%lld")