Advertisement
bhushan23

codesheffeb1jewel.c

Feb 4th, 2013
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.51 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<string.h>
  3. int main()
  4. {
  5. int i,T,k,len,count,t,ar[52]={0};
  6. char S[200];
  7.  
  8. scanf("%d",&T);
  9.  
  10. while(T--)
  11. {
  12. count=0;
  13. t=0;
  14. for(i=0;i<52;i++)
  15. ar[i]=0;
  16.     scanf("%s",S);
  17.     len=strlen(S);
  18.     for(i=0;i<len;i++)
  19.     {
  20.     if('a'<=S[i]&&S[i]<='z')
  21.        { k=S[i]-'a';
  22.      ar[k]++;
  23.         }
  24.    else if('A'<=S[i]&&S[i]<='Z')
  25.        { k=S[i]-'A'+26;
  26.    ar[k]++;
  27.       }
  28.         }
  29.    for(i=0;i<52;i++)
  30.    {
  31.    t=ar[i]/2+(ar[i]%2);
  32.    count+=t;
  33.  }
  34.    printf("%d",count);
  35.   }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement