#include"stdio.h"
/*定义一个读字符函数*/
int c=1;
void ReadCharacter(char str[])
{
int i=1;
scanf("%c",&str[0]);
while(str[i-1]!='!')
{
scanf("%c",&str[i]);
i=i+1;
c=c+1;
}
}
void count(int b[],char str[])
{
int i;
for(i=0;i<=c;i++)
b[str[i]]+=1;
}
void printfresult(int b[])
{
int i;
for(i='A';i<='Z';i++)
{
if(b[i]!=0)
printf("%d个%c\n",b[i],i);
}
}
int main()
{
int i;
char str[127];
int b[127]={0};
FILE *fp;
fp=fopen("c://my answer.txt","w");
printf("please input your character:\n");
fprintf(fp,"please input your character:\n");
ReadCharacter( str);
count(b,str);
printf("结果\n");
printfresult(b);
fclose(fp);
return 0;
}