func_code_string: #include <bits/stdc++.h>   using namespace std;   char str[100010];   int dp[26][100010];   int maxP[260][260][260];   int len[3];   int idx[3];   char desc[3][260];   int get(int rel) {     int m = maxP[idx[0] - (rel == 0)][idx[1] - (rel == 1)][idx[2] - (rel == 2)];     if (m == 100010) return 100010;     return dp[desc[rel][idx[rel] - 1] -  a ][m];   }   int main(void) {     setbuf(stdout, 0);     int N, Q;     cin >> N >> Q;     cin >> str;     for (int i = 0; i < 26; i++) dp[i][N] = 100010;     for (int i = 0; i < N; i++) {       for (int j = 0; j < 26; j++) {         if (str[N - 1 - i] ==  a  + j)           dp[j][N - 1 - i] = N - i;         else           dp[j][N - 1 - i] = dp[j][N - i];       }     }     for (int q = 0; q < Q; q++) {       char o, c;       int i;       cin >> o >> i;       i--;       if (o ==  + ) {         cin >> c;         desc[i][len[i]++] = c;         idx[i] = len[i];         if (i == 0) {           for (int j = 0; j <= len[1]; j++) {             idx[1] = j;             for (int k = 0; k <= len[2]; k++) {               idx[2] = k;               maxP[len[0]][j][k] = get(i);               if (j) maxP[len[0]][j][k] = min(maxP[len[0]][j][k], get(1));               if (k) maxP[len[0]][j][k] = min(maxP[len[0]][j][k], get(2));             }           }         }         if (i == 1) {           for (int j = 0; j <= len[0]; j++) {             idx[0] = j;             for (int k = 0; k <= len[2]; k++) {               idx[2] = k;               maxP[j][len[1]][k] = get(i);               if (j) maxP[j][len[1]][k] = min(maxP[j][len[1]][k], get(0));               if (k) maxP[j][len[1]][k] = min(maxP[j][len[1]][k], get(2));             }           }         }         if (i == 2) {           for (int j = 0; j <= len[0]; j++) {             idx[0] = j;             for (int k = 0; k <= len[1]; k++) {               idx[1] = k;               maxP[j][k][len[2]] = get(i);               if (j) maxP[j][k][len[2]] = min(maxP[j][k][len[2]], get(0));               if (k) maxP[j][k][len[2]] = min(maxP[j][k][len[2]], get(1));             }           }         }       } else         len[i]--;       cout << (maxP[len[0]][len[1]][len[2]] < 100010 ?  YES n  :  NO n );     }     return 0;   }   