fork(3) download
  1. #include<stdio.h>
  2. #include<math.h>
  3. #include<ctype.h>
  4. int main()
  5. {
  6. int t,i,b[26],j,max=0,k=0,p=0;
  7. char ch[100000],maxc;
  8. scanf("%d",&t);
  9. for(i=0;i<t;i++)
  10. {
  11. max=0;
  12. k=0;
  13. for(j=0;j<26;j++)
  14. {
  15. b[j]=0;
  16. }
  17. scanf("%s",ch);
  18.  
  19. while(ch[k]!='\0')
  20. {
  21.  
  22.  
  23. if(isupper(ch[k]))
  24. {
  25. b[ch[k]-65]++;
  26. }
  27. else if(islower(ch[k]))
  28. {
  29. b[ch[k]-97]++;
  30. }
  31.  
  32. k++;
  33.  
  34. }
  35.  
  36.  
  37. max=0;
  38. p=0;
  39. while(p<26)
  40. {
  41.  
  42. if(b[p]>=max)
  43. {
  44. max=b[p];
  45. maxc=p+97;
  46. }
  47. p++;
  48. }
  49. printf("%c\n",maxc);
  50. }
  51. }
  52.  
Success #stdin #stdout 0s 2032KB
stdin
5
HHaaPPyy!!
abcde
AAbCCdeee
CCCCCCCCCCCCdddseeeeeeeeeeeeeeeee
AGHJI
IIOOO&&&&%%
stdout
y
e
e
e
j