#include<stdio.h>
int main()
{
char ch;
int n1=0,kongge=0,n2=0,other=0;
while((ch=getchar())!='\n') {
if((ch>='a'&&ch<='z')||(ch<='Z'&&ch>='A'))
{
n1++;
}
else if(ch==' ')
{
kongge++;
}
else if(ch>='0'&&ch<='9')
{
n2++;
}
else
{
other++;
}
}
printf("%d %d %d %d\n",n1,n2,kongge,other);
return 0;
}
输入一串字符,统计其中字母,数字,空格及其他符号的个数
最新推荐文章于 2022-04-17 17:13:24 发布