func_code_string: #include <bits/stdc++.h>   using namespace std;   const int maxn = 40;   long long int dp[maxn][maxn], P[maxn], par[maxn][maxn];   string s;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     P[0] = 1;     for (int i = 1; i < maxn; i++) P[i] = P[i - 1] * 10;     cin >> s >> s;     for (int i = ((int)(s).size()) - 1; i >= 0; i--) {       for (int j = 0; j <= ((int)(s).size()) - i; j++) {         long long int pnt1, pnt2;         if (j == 0)           dp[i][j] = dp[i + 1][j] + (s[i] -  0 ) * P[((int)(s).size()) - i - 1],           par[i][j] = j;         else if (j == ((int)(s).size()) - i)           dp[i][j] = dp[i + 1][j - 1] + (s[i] -  0 ) * P[j - 1],           par[i][j] = j - 1;         else if ((pnt1 = dp[i + 1][j - 1] + (s[i] -  0 ) * P[j - 1]) >                  (pnt2 = dp[i + 1][j] +                          (s[i] -  0 ) * P[((int)(s).size()) - i - j - 1]))           dp[i][j] = pnt1, par[i][j] = j - 1;         else           dp[i][j] = pnt2, par[i][j] = j;       }     }     int row = 0, col = ((int)(s).size()) / 2;     while (row < ((int)(s).size())) {       if (par[row][col] == col)         cout <<  H ;       else         cout <<  M ;       col = par[row][col];       row++;     }     return 0;   }   