fork download
  1. #include <stdio.h>
  2. #include <string.h>
  3.  
  4. char voca[1000000];
  5. int count[1000000];
  6.  
  7. int main()
  8. {
  9. int length = 0, max = 0;
  10. char result = '\0';
  11.  
  12. scanf("%s", voca);
  13. length = strlen(voca);
  14. for (int i = 0; i < length; i++)
  15. {
  16. if (voca[i] > 90)
  17. {
  18. voca[i] = voca[i] - 32;
  19. }
  20. }//대소문자 변환
  21. if (length == 1)//한글자 짜리
  22. {
  23. printf("%c", voca[0]);
  24. }
  25. for (int j = 0; j < length - 1; j++)
  26. {
  27. for (int k = j + 1; k < length; k++)
  28. {
  29. if (voca[j] == voca[k] && voca[j] != 0)
  30. {
  31. count[j]++;
  32. voca[k] = 0;
  33. }
  34. else if (voca[j] == 0)
  35. {
  36. break;
  37. }
  38. }
  39. if (count[j] > max)
  40. {
  41. max = count[j];
  42. result = voca[j];
  43. }
  44. else if (count[j] == max)
  45. {
  46. result = "?";
  47. }
  48. }
  49. printf("%c", result);
  50.  
  51. return 0;
  52. }
Success #stdin #stdout 0s 4400KB
stdin
Mississipi
stdout