Advertisement
mhdew

nadim_8

Aug 13th, 2021
885
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.35 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<string.h>
  3.  
  4. int main(){
  5.  
  6.     char s[111111];
  7.     gets(s);
  8.     int ct[1111];
  9.     int i;
  10.  
  11.     for(i=0;i<1111;i++){
  12.         ct[i]=0;
  13.     }
  14.  
  15.     for(i=0;i<strlen(s);i++){
  16.         if(s[i]>='a' && s[i]<='z'){
  17.             ct[s[i]]++;
  18.         }
  19.     }
  20.  
  21.     for(i='a';i<='z';i++){
  22.         if(ct[i]!=0){
  23.             printf("%c is repeated %d times\n", i,ct[i]);
  24.         }
  25.     }
  26.  
  27.     return 0;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement