#include "stdio.h"
main()
{char c,sum1=0,sum2=0,space=0,number=0,other=0;
c=getchar();
while(c!='\n')
{
if(c>='A'&&c<='Z') sum1++;
else if(c>='a'&&c<='z') sum2++;
else if(c>='0'&&c<='9') number++;
else if(c==' ') space++;
else other ++;
c=getchar();
}
printf("%d,%d,%d,%d,%d",sum1,sum2,space,number,other);
}
#include "stdio.h"
int fun(char s[])
{
int i,n=0;
for(i=0;s[i]!='\0';i++)
{
if(s[i]>='A'&&s[i]<='z')
n++;
}
return n;
}
main()
{
char str[]="Best wishes for you!";
int k;
k=fun(str);
printf("k=%d\n",k);
}
友友参考下吧,我不想再改了,毕竟友友也需要自己思考下的……