func_code_string: #include <bits/stdc++.h>   using namespace std;   struct no {     long long i, h, m;   };   long long dp[40][40][40];   char str[40];   no pre[40][40][40];   long long pw[19];   vector<char> ans;   int main() {     long long n;     scanf( %lld , &n);     scanf( %s , str + 1);     pw[0] = 1;     for (long long i = 1; i < 19; i++) pw[i] = pw[i - 1] * 10LL;     for (long long i = 0; i < 40; i++)       for (long long j = 0; j < 40; j++)         for (long long k = 0; k < 40; k++) dp[i][j][k] = -9999999999999LL;     dp[0][0][0] = 0;     pre[0][0][0] = {-1, -1, -1};     for (long long i = 1; i <= 2 * n; i++) {       for (long long h = 0; h <= n; h++) {         for (long long m = 0; m <= n; m++) {           if (h) {             if (dp[i - 1][h - 1][m] + pw[n - h] * (str[i] -  0 ) > dp[i][h][m]) {               dp[i][h][m] = dp[i - 1][h - 1][m] + pw[n - h] * (str[i] -  0 );               pre[i][h][m] = {i - 1, h - 1, m};             }           }           if (m) {             if (dp[i - 1][h][m - 1] + pw[n - m] * (str[i] -  0 ) > dp[i][h][m]) {               dp[i][h][m] = dp[i - 1][h][m - 1] + pw[n - m] * (str[i] -  0 );               pre[i][h][m] = {i - 1, h, m - 1};             }           }         }       }     }     no check = {-1, -1, -1};     no tren = {2 * n, n, n};     no pred = pre[tren.i][tren.h][tren.m];     while (pred.i != -1) {       if (tren.h == pred.h)         ans.push_back( M );       else         ans.push_back( H );       tren = pred;       pred = pre[tren.i][tren.h][tren.m];     }     reverse(ans.begin(), ans.end());     for (long long i = 0; i < ans.size(); i++) printf( %c , ans[i]);     return 0;   }   