func_code_string: #include <bits/stdc++.h>   using namespace std;   inline int read() {     int x = 0, y = 0;     char ch = getchar();     while (ch <  0  || ch >  9 ) {       if (ch ==  - ) y = 1;       ch = getchar();     }     while (ch >=  0  && ch <=  9 )       x = (x << 1) + (x << 3) + (ch ^ 48), ch = getchar();     return y ? -x : x;   }   template <typename T>   inline T read() {     T x = 0;     int y = 0;     char ch = getchar();     while (ch <  0  || ch >  9 ) {       if (ch ==  - ) y = 1;       ch = getchar();     }     while (ch >=  0  && ch <=  9 )       x = (x << 1) + (x << 3) + (ch ^ 48), ch = getchar();     return y ? -x : x;   }   char s[40];   long long pw[40] = {-0x3f3f3f3f, 1}, f[40][40];   bool g[40][40];   signed main() {     int n = read();     scanf( %s , s + 1);     for (register int i = 2; i <= n; ++i) pw[i] = pw[i - 1] * 10;     memset(f, ~0x3f, sizeof f);     f[(n << 1) + 1][0] = 0;     for (register int i = n << 1; i; --i)       for (register int j = 0; j <= min((n << 1) - i + 1, n); ++j) {         f[i][j] = max(f[i + 1][j - 1] + pw[j] * (s[i] -  0 ),                       f[i + 1][j] + pw[(n << 1) - i + 1 - j] * (s[i] -  0 ));         g[i][j] = f[i + 1][j - 1] + pw[j] * (s[i] -  0 ) >                   f[i + 1][j] + pw[(n << 1) - i + 1 - j] * (s[i] -  0 );       }     for (register int i = 1, j = n; i <= n << 1; ++i)       putchar(g[i][j] ?  H  :  M ), j -= g[i][j];     putchar(  n );   }   