
#include<stdio.h>
void statistic(char *s,int *letter,int *space ,int *digit,int *other)
{
if(s == NULL) return ;
for(int i=0;i<strlen(s);++i)
{
if(isalpha(s[i])) ++(*letter);
else if(isdigit(s[i])) ++(*digit);
else if(isspace(s[i])) ++(*space);
else ++(*other);
}
}
int main()
{
printf("string=");
char str[100];
gets(str);
printf("total:%d\n",strlen(str));
int letter=0, space=0 ,digit=0,other=0;
statistic(str,&letter,&space ,&digit,&other);
printf("letter:%d,digit:%d,space:%d,others:%d\n",letter,digit,space,other);
return 0;
}