fork download
  1. #include <stdio.h>
  2. #include <string.h>
  3. int main()
  4. {
  5. char a[10000001];
  6. scanf("%s", a);
  7. int cnt[26]={0};
  8. for(int i=0;i<strlen(a);i++){
  9. int v=a[i]-97;
  10. cnt[v]++;
  11. }
  12.  
  13. for(int i=0;i<26;i++){
  14. if(cnt[i]!=0){
  15. printf("%c : %d\n",i+97,cnt[i]);
  16. }
  17. cnt[i]=0;
  18. }
  19. return 0;
  20. }
Success #stdin #stdout 0s 5304KB
stdin
regff
stdout
e : 1
f : 2
g : 1
r : 1