#include <stdio.h>
int main()
{
char *p,string[255];
int ch=0,space=0,number=0,other=-1;
fgets(string,255,stdin);
p=string;
do
{
if(!(*p)) break;
else if(!strlen(string)){other=0;break;}
if(*p>='A'&&*p<='z') ch++;
else if(*p==' ')
space++;
else if(*p>='0'&&*p<='9') number++;
else other++;
}while(p++,1);
printf("char\t%d\nspace\t%d\nnumber\t%d\nother\t%d\n",
ch,space,number,other);
}
[此贴子已经被作者于2005-3-26 13:18:45编辑过]