fork download
  1. using System;
  2.  
  3. namespace _45Acsharp
  4. {
  5. class Program
  6. {
  7. static int CanWin(string s1, string s2)
  8. {
  9. int a, b;
  10. if (s1[0] == 'r')
  11. a = 1;
  12. else if (s1[0] == 'p')
  13. a = 2;
  14. else a = 3;
  15.  
  16. if (s2[0] == 'r')
  17. b = 1;
  18. else if (s2[0] == 'p')
  19. b = 2;
  20. else b = 3;
  21.  
  22. if (a == 1)
  23. {
  24. if (b == 2)
  25. return 2;
  26. if (b == 3)
  27. return 1;
  28. }
  29. if (a == 2)
  30. {
  31. if (b == 3)
  32. return 2;
  33. if (b == 1)
  34. return 1;
  35. }
  36.  
  37. if (a == 3)
  38. {
  39. if (b == 1)
  40. return 2;
  41. if (b == 2)
  42. return 1;
  43. }
  44. return 0;
  45. }
  46.  
  47. static void Main(string[] args)
  48. {
  49. string s1, s2, s3;
  50. s1 = Console.ReadLine();
  51. s2 = Console.ReadLine();
  52. s3 = Console.ReadLine();
  53. int c = -1;
  54.  
  55. if ((s1[0] != s2[0]) && (s1[0] != s3[0]) && (s2[0] != s3[0]))
  56. {
  57. Console.WriteLine("?");
  58. return;
  59. }
  60. if ((s1[0] == s2[0]) && (s1[0] == s3[0]) && (s2[0] == s3[0]))
  61. {
  62. Console.WriteLine("?");
  63. return;
  64. }
  65. if ((s2[0] == s3[0]) &&(s1[0] != s2[0]))
  66. {
  67. c = CanWin(s1, s2);
  68. if (c == 0) { Console.WriteLine("?"); return; }
  69. if (c==2) Console.WriteLine("?");
  70. else Console.WriteLine("F");
  71. }
  72. else if ((s1[0] == s3[0]) && (s2[0] != s3[0]))
  73. {
  74. c = CanWin(s2, s3);
  75. if (c == 0) { Console.WriteLine("?"); return; }
  76. if (c == 2) Console.WriteLine("?");
  77. else Console.WriteLine("M");
  78. }
  79. else if ((s1[0] == s2[0]) && (s1[0] != s3[0]))
  80. {
  81. c = CanWin(s3, s1);
  82. if (c == 0) { Console.WriteLine("?"); return; }
  83. if (c == 2) Console.WriteLine("?");
  84. else Console.WriteLine("S");
  85. }
  86.  
  87. }
  88. }
  89. }
  90.  
Success #stdin #stdout 0.03s 36944KB
stdin
scissors
rock
rock
stdout
?