func_code_string: #include <bits/stdc++.h>   using namespace std;   int n, len, dp[200][100][2][2];   char x[200];   const int unDEF = 10000, INF = 1000000000;   int solve(int idx, int left, int dir, int isM) {     if (idx < 0) {       if (left + dir == 0) {         return 0;       }       if (isM) {         return -INF;       }       return INF;     }     int &temp = dp[idx][left][dir][isM];     if (temp != unDEF) {       return temp;     }     if (isM) {       temp = -INF;     } else       temp = INF;     int sign = dir ? -1 : 1;     for (int i = 0; i <= left; i++) {       int newDir = (x[idx] !=  T ) ^ (i & 1);       if (newDir) {         if (isM) {           temp = max(temp, solve(idx - 1, left - i, dir, isM) + sign);         } else {           temp = min(temp, solve(idx - 1, left - i, dir, isM) + sign);         }       } else {         if (isM) {           temp = max(temp, solve(idx - 1, left - i, dir ^ 1, isM));         } else {           temp = min(temp, solve(idx - 1, left - i, dir ^ 1, isM));         }       }     }     return temp;   }   int main() {     cin >> x >> n;     len = strlen(x);     for (int i = 0; i < len; i++) {       for (int j = 0; j <= n; j++) {         for (int k = 0; k < 2; k++) {           for (int l = 0; l < 2; l++) {             dp[i][j][k][l] = unDEF;           }         }       }     }     int ans = 0, a = solve(len - 1, n, 0, 0), b = solve(len - 1, n, 0, 1),         c = solve(len - 1, n, 1, 0), d = solve(len - 1, n, 1, 1);     if (a < 1000) ans = max(ans, abs(a));     if (c < 1000) ans = max(ans, abs(c));     if (b > -1000) ans = max(ans, abs(b));     if (d > -1000) ans = max(ans, abs(d));     cout << ans <<   n ;     return 0;   }   