文章
55
粉丝
100
获赞
12
访问
31.0k
#include<stdio.h>
#include<string>
#include<iostream>
using namespace std;
int main(){
int ch=0,shu=0,kong=0,el=0;
string str;
getline(cin,str);
int len = str.length();
for(int i = 0; i<len; i++){
if(str[i]>='0'&&str[i]<='9'){
shu++;
}else if((str[i]>='a'&&str[i]<='z') || (str[i]>='A'&&str[i]<='Z')){
ch++;
}else if(str[i] == ' '){
kong++;
}else{
el++;
}
}
cout<<ch<<" "<<shu<<" "<<kong<<" "<<el<<endl;
}
登录后发布评论
暂无评论,来抢沙发