输入一行字符,分别统计出其中英文字母、数字、
空格和其他字符的个数。
输入
一行字符
输出
统计值
样例输入
aklsjflj123 sadf918u324 asdf91u32oasdf/.';123
样例输出
23 16 2
#include<stdio.h>
int main()
{
char ch;
int char_num=0,kg_num=0,int_num=0,other_num=0;
ch=getchar();
while((ch=getchar())!='\n')
{
if(ch>='a'&&ch<='z'||ch<='z'&&ch>='a')
{
char_num++;
}
else if(ch==' ')
{
kg_num++;
}
else if(ch>='0'&&ch<='9')
{
int_num++;
}
else
{
other_num++;
}
}
printf("%d %d %d %d",char_num,int_num,kg_num,other_num);
return 0;
}