fork(1) download
  1. // iostream is too mainstream
  2. #include <cstdio>
  3. // bitch please
  4. #include <iostream>
  5. #include <algorithm>
  6. #include <cstdlib>
  7. #include <vector>
  8. #include <set>
  9. #include <map>
  10. #include <queue>
  11. #include <stack>
  12. #include <list>
  13. #include <cmath>
  14. #include <iomanip>
  15. #define dibs reserve
  16. #define OVER9000 1234567890
  17. #define ALL_THE(CAKE,LIE) for(auto LIE =CAKE.begin(); LIE != CAKE.end(); LIE++)
  18. #define tisic 47
  19. #define soclose 1e-8
  20. #define chocolate win
  21. // so much chocolate
  22. #define patkan 9
  23. #define ff first
  24. #define ss second
  25. #define abs(x) ((x < 0)?-(x):x)
  26. #define uint unsigned int
  27. #define dbl long double
  28. using namespace std;
  29. // mylittledoge
  30.  
  31. int main() {
  32. cin.sync_with_stdio(0);
  33. cin.tie(0);
  34. int N;
  35. string s;
  36. cin >> N >> s;
  37. int d =0;
  38. for(int i =0; i < N-1; i++) {
  39. if(s[i] == 'H') d++;
  40. else d--;}
  41. if(d > 0) {cout << "H\n"; return 0;}
  42. if(d < 0) {cout << "M\n"; return 0;}
  43.  
  44. if(N == 1) {cout << "HM\n"; return 0;}
  45.  
  46. if(s[N-2] == 'H') cout << "M\n";
  47. else cout << "H\n";
  48. return 0;}
  49.  
  50. // look at my code
  51. // my code is amazing
Runtime error #stdin #stdout 0s 3476KB
stdin
Standard input is empty
stdout
Standard output is empty