题解 | #统计大写字母个数#
统计大写字母个数
http://www.nowcoder.com/practice/434414efe5ea48e5b06ebf2b35434a9c
#include <bits/stdc++.h>
using namespace std;
int main(){
string str = "";
while(getline(cin, str)){
int res = 0;
for(char ch : str){
if(ch >= 'A' && ch <= 'Z'){
res++;
}
}
cout << res << endl;
}
return 0;
}
华为题库题解 文章被收录于专栏
牛客华为题库的题解