题解 | #统计字符#
统计字符
http://www.nowcoder.com/practice/539054b4c33b4776bc350155f7abd8f5
#include <bits/stdc++.h>
using namespace std;
int main(){
string m;
int grand;
while(getline(cin, m)){
int alpha=0,kg=0,numb=0;
for(int i=0;i<m.size();++i){
if(isalpha(m[i])) alpha++;
else if(m[i]==' ') kg++;
else if(m[i]>='0'&&m[i]<='9') numb++;
}
cout<<alpha<<endl<<kg<<endl<<numb<<endl<<m.size()-alpha-kg-numb<<endl;
}
return 0;
}