#include<stdio.h>
int main()
{
int zimu,shu,kong,other;
char ch;
zimu=shu=kong=other=0;
for(;(ch=getchar())!='\n';)
if((ch>='a'&&ch<='z')||(ch>='A'&&ch<='Z'))
zimu++;
else if(ch>='1'&&ch<='9')
shu++;
else if(ch==' ')
kong++;
else
other++;
printf("字母%d个,空格%d个,数字%d个,其他%d个\n",zimu,kong,shu,other);
return 0;
}
输入一串字符计算其中字母空格数字和其他的个数
sdasdsad#@$$@#$ewrw11133
字母12个,空格0个,数字5个,其他7个