C++解法
#include<bits/stdc++.h> using namespace std; int main() { string str; while(getline(cin,str)) { int num=0; for(int i=0;i<str.size();i++) { if(str[i]>='A'&&str[i]<='Z') num+=1; } cout<<num<<endl; } }
#include<bits/stdc++.h> using namespace std; int main() { string str; while(getline(cin,str)) { int num=0; for(int i=0;i<str.size();i++) { if(str[i]>='A'&&str[i]<='Z') num+=1; } cout<<num<<endl; } }