第1个回答 2010-11-07
#include <stdio.h>
void main()
{
char c;
int abc=0;
int num=0;
int space=0;
int other=0;
while((c=getchar())!='\n')
{
if((c>='a'&&c<='z')||(c>='A'&&c<='Z'))
abc++;
else if((c>='0')&&(c<='9'))
num++;
else if(c==' ')
space++;
else
other++;
}
printf("abc=%d\nnum=%d\nspace=%d\nother=%d\n",abc,num,space,other);
}