#include<stdio.h>
int main()
{
char c;
int letters=0,space=0,digit=0,others=0;
while((c=getchar())!='\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 %d %d %d",letters,space,digit,others);
return 0;
}
本篇为本人大一经过蓝桥杯,进学校实验室等一系列考试后,感觉有用并且常考的题型,希望对大家有用!!!(也算是复习C语言的一篇笔记吧!哈哈)