题解 | #字符统计#投机取巧了...
字符统计
https://www.nowcoder.com/practice/c1f9561de1e240099bdb904765da9ad0
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int main()
{
int i,j,count=0;
int hash[128]={0};
char str[1001];
scanf("%s",str);
for(i=0;i<strlen(str);i++)
{
hash[str[i]]++;
}
//printf("%d",hash['c']);
for(i=1000;i>=1;i--)
{
for(j=0;j<128;j++)
{
if(i==hash[j])
printf("%c",j);
}
}
return 0;
}