//纯C语言版
#include <stdio.h>
int main()
{
char str[64], *phead=str, *pnow, c;
unsigned n;
gets(str);
while (*phead!=0)
{
for (n=1, c=*phead, pnow=phead+1;*pnow;pnow++)
if (c==*pnow)
{
n++;
*pnow=-1; //用-1标明此处已被删除
}
printf("字符%c出现了%d次\n",c,n);
while (*++phead==-1);
}
return 0;
}