解题思路:
注意事项:
参考代码:
#include<iostream>
#include <bits/stdc++.h>
using namespace std;
int main(){
char s[100];
gets(s);
int len1=strlen(s);
int a1=0,b1=0,c1=0,d1=0;
cout<<s.length()<<endl;
for(int i=0;i<len1;i++)
{
if((s[i]>='a'&&s[i]<='z')||(s[i]>='A'&&s[i]<='Z'))
a1++;
else if(s[i]>='0'&&s[i]<='9')
b1++;
else if(s[i]==' ')
c1++;
else
d1++;
}
cout<<a1<<" "<<b1<<" "<<c1<<" "<<d1;
}
0.0分
0 人评分