//========================================
//*create time :2020-05-19 11:17
//*filename:practice.c
//*description:统计字符串个数 字符范围在0-256之间,所以可以定义一个数组,值对应的加1
//========================================
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main()
{
char *t = "hello**^$@)*^$#@#hellojli";
char *s =t;
int arr[256]= {0};
while(*s){
arr[*s]++;
s++;
}
int i = 0;
s=t;
while(i<256){
if(arr[i] != 0)
printf("%c have %d\n",i, arr[i]);
i++;
}
return 0;
}