解题思路:
注意事项:
参考代码:
#include<stdio.h>
#include<string.h>
int main()
{
int letter=0,number=0,space=0,other=0;
char str[100];
gets(str);
for(int i=0;i<strlen(str);i++)
{
if(str[i]>='a'&&str[i]<='z'||str[i]>='A'&&str[i]<='Z')
letter++;
else if(str[i]>='0'&&str[i]<='9')
number++;
else if(str[i]==' ')
space++;
else
other++;
}
printf("%d %d %d %d",letter,number,space,other);
return 0;
}
0.0分
1 人评分