func_code_string: #include <bits/stdc++.h>   using namespace std;   const int MAX = 1e5 + 4;   string s, des[3];   int n, q, next_occur[26][MAX], dp[255][255][255];   void makeNO() {     for (int j = 0; j < 26; j++) next_occur[j][n + 1] = next_occur[j][n] = n;     for (int i = n - 1; i >= 0; i--) {       for (int j = 0; j < 26; j++) {         next_occur[j][i] = (s[i] -  a  == j ? i : next_occur[j][i + 1]);       }     }   }   void makeDp(int a, int b, int c) {     int& val = dp[a][b][c];     val = n;     if (a) val = min(val, next_occur[des[0][a - 1] -  a ][dp[a - 1][b][c] + 1]);     if (b) val = min(val, next_occur[des[1][b - 1] -  a ][dp[a][b - 1][c] + 1]);     if (c) val = min(val, next_occur[des[2][c - 1] -  a ][dp[a][b][c - 1] + 1]);   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(nullptr);     cout.tie(nullptr);     ;     cin >> n >> q >> s;     makeNO();     dp[0][0][0] = -1;     while (q--) {       char o, c;       int rel_id;       cin >> o >> rel_id;       rel_id--;       if (o ==  + ) {         cin >> c;         des[rel_id] += c;         int max0 = des[0].size(), max1 = des[1].size(), max2 = des[2].size();         int min0 = rel_id == 0 ? max0 : 0;         int min1 = rel_id == 1 ? max1 : 0;         int min2 = rel_id == 2 ? max2 : 0;         for (int b = min1; b <= max1; b++)           for (int a = min0; a <= max0; a++)             for (int c = min2; c <= max2; c++) makeDp(a, b, c);       } else {         des[rel_id].pop_back();       }       bool answer = dp[des[0].size()][des[1].size()][des[2].size()] < n;       cout << (answer ?  YES n  :  NO n );     }   }   