#include <stdio.h> int count(char *s,int *t) { char *p=s; while(*p!='\0') { if(*p>='a' && *p<='z' || *p>='A' && *p<='Z') t[0]++; else if(*p>='0' && *p<='9') t[1]++; else if(*p==' ') t[2]++; else t[3]++; p++; } } int main() { int i,t[4]; char s[100]; while(gets(s)) { for(i=0;i<4;i++) t[i]=0; count(s,t); for(i=0;i<4;i++) printf("%d ",t[i]); printf("\n"); } }

评论