func_code_string: #include <bits/stdc++.h>   using namespace std;   char pal[111];   int nn, L;   int dp[101][55][2];   bool calc[101][55][2];   pair<int, int> pai[101][55][2];   int go(int ini, int n, bool pos) {     int r1;     if (ini == L) {       pai[ini][n][pos] = make_pair(n, pos);       return (n % 2 != 0) * (-0x3f3f3f3f);     }     if (!calc[ini][n][pos]) {       calc[ini][n][pos] = true;       int resp = 0;       if (pal[ini] ==  F ) {         resp = go(ini + 1, n, pos) + pos - (!pos);         if (n)           r1 = go(ini + 1, n - 1, !pos);         else           r1 = -0x3f3f3f3f;         if (resp > r1) {           pai[ini][n][pos] = make_pair(n, pos);         } else {           resp = r1;           pai[ini][n][pos] = make_pair(n - 1, !pos);         }       } else {         resp = go(ini + 1, n, !pos);         if (n)           r1 = go(ini + 1, n - 1, pos) + pos - (!pos);         else           r1 = -0x3f3f3f3f;         if (resp > r1) {           pai[ini][n][pos] = make_pair(n, !pos);         } else {           resp = r1;           pai[ini][n][pos] = make_pair(n - 1, pos);         }       }       dp[ini][n][pos] = resp;     }     return dp[ini][n][pos];   }   void psol(int ind, int n, bool opa) {     if (ind == L) return;     if (n == pai[ind][n][opa].first)       cout << pal[ind];     else if (pal[ind] ==  T )       cout <<  F ;     else       cout <<  T ;     psol(ind + 1, pai[ind][n][opa].first, pai[ind][n][opa].second);   }   int main() {     while (scanf( %s %d , pal, &nn) == 2) {       L = strlen(pal);       memset(calc, false, sizeof(calc));       int r1 = go(0, nn, true);       int r2 = go(0, nn, false);       printf( %d n , max(r2, r1));     }     return 0;   }   