#include <stdio.h>
#include <string.h>
void main(){
char c;
int letters=0,space=0,digit=0,others=0;
while((c=getchar()) && c!='\n'){
if((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'))
letters++;
else if(c==' ')
space++;
else if(c>='0' && c<='9')
digit++;
else
others++;
}
printf("%d\n%d\n%d\n%d",letters,space,digit,others);
}
输入一行字符,分别统计出其中的英文字母、空格、数字和其他字符
最新推荐文章于 2022-11-24 11:28:36 发布