func_code_string: #include <bits/stdc++.h>   using namespace std;   template <typename T, typename U>   inline void smin(T &a, const U &b) {     if (a > b) a = b;   }   template <typename T, typename U>   inline void smax(T &a, const U &b) {     if (a < b) a = b;   }   char s[100100], ss[4][100100];   int nxt[100100][26], N[4];   int dp[255][255][255], n;   inline void calc(int a_st, int a_ed, int b_st, int b_ed, int c_st, int c_ed) {     for (int i = a_st; i <= a_ed; i++) {       for (int j = b_st; j <= b_ed; j++) {         for (int k = c_st; k <= c_ed; k++) {           if (!i && !j && !k)             dp[i][j][k] = 0;           else {             dp[i][j][k] = 0x3f3f3f3f;             if (i && dp[i - 1][j][k] < n)               smin(dp[i][j][k], nxt[dp[i - 1][j][k] + 1][ss[1][i] -  a ]);             if (j && dp[i][j - 1][k] < n)               smin(dp[i][j][k], nxt[dp[i][j - 1][k] + 1][ss[2][j] -  a ]);             if (k && dp[i][j][k - 1] < n)               smin(dp[i][j][k], nxt[dp[i][j][k - 1] + 1][ss[3][k] -  a ]);           }         }       }     }   }   int main() {     int q;     scanf( %d %d %s , &n, &q, s + 1);     for (int i = 26; i--;) nxt[n + 1][i] = n + 1;     for (int i = n; i >= 1; i--) {       for (int j = 26; j--;) nxt[i][j] = nxt[i + 1][j];       nxt[i][s[i] -  a ] = i;     }     while (q--) {       char c;       scanf(  %c , &c);       if (c ==  + ) {         int id;         scanf( %d %c , &id, &c);         ss[id][++N[id]] = c;         if (id == 1) calc(N[1], N[1], 0, N[2], 0, N[3]);         if (id == 2) calc(0, N[1], N[2], N[2], 0, N[3]);         if (id == 3) calc(0, N[1], 0, N[2], N[3], N[3]);       } else {         int id;         scanf( %d , &id);         N[id]--;       }       puts(dp[N[1]][N[2]][N[3]] <= n ?  YES  :  NO );     }   }   