Advertisement
gihanchanaka

Untitled

May 9th, 2017
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.44 KB | None | 0 0
  1. /*Problem 13 GROUP 3*/
  2.  
  3. #include <stdio.h>
  4. #include <stdlib.h>
  5.  
  6. int main(){
  7.     char* s1=(char*)malloc(1000);
  8.     printf("Input String 1 : ");
  9.     scanf("%s",s1);
  10.    
  11.  
  12.     int* count=(int*)calloc(sizeof(int),256);
  13.     int x=0;
  14.     while(s1[x]!='\0'){
  15.         if(s1[x]>='A' && s1[x]<='Z')s1[x]+=('a'-'A');
  16.         count[s1[x]]++;
  17.         //printf("%c\n",s1[x]);
  18.         x++;
  19.     }
  20.    
  21.  
  22.     for(x=0;x<256;x++){
  23.         if(count[x]>0){
  24.             printf("%c >> %d\n", x,count[x]);
  25.         }
  26.     }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement