func_code_string: #include <bits/stdc++.h>   using namespace std;   using ll = long long;   int n, q;   string s;   int dp[251][251][251];   int nxt[26][112345];   int len[3];   int chs[3][250];   template <class T, class U>   inline void smax(T &a, U b) {     a = a > b ? a : b;   }   template <class T, class U>   inline void smin(T &a, U b) {     a = a < b ? a : b;   }   int main() {     std::ios::sync_with_stdio(false), std::cin.tie(0);     cin >> n >> q;     cin >> s;     for (int i = 0; i < 26; i++) {       nxt[i][n] = nxt[i][n + 1] = n;       for (int j = n - 1; j >= 0; j--)         if (s[j] ==  a  + i)           nxt[i][j] = j;         else           nxt[i][j] = nxt[i][j + 1];     }     dp[0][0][0] = -1;     for (int t = 0; t < q; t++) {       char c;       int group;       cin >> c >> group;       group -= 1;       if (c ==  + ) {         char ch;         cin >> ch;         chs[group][len[group]] = ch -  a ;         len[group]++;         int i[3];         for (i[0] = group == 0 ? len[0] : 0; i[0] <= len[0]; i[0]++)           for (i[1] = group == 1 ? len[1] : 0; i[1] <= len[1]; i[1]++)             for (i[2] = group == 2 ? len[2] : 0; i[2] <= len[2]; i[2]++) {               if (!i[0] && !i[1] && !i[2]) continue;               dp[i[0]][i[1]][i[2]] = n;               for (int k = 0; k < 3; k++) {                 if (i[k] > 0) {                   smin(dp[i[0]][i[1]][i[2]],                        nxt[chs[k][i[k] - 1]]                           [dp[i[0] - (0 == k)][i[1] - (1 == k)][i[2] - (2 == k)] +                            1]);                 }               }             }       } else {         len[group]--;       }       cout << ((dp[len[0]][len[1]][len[2]] < n) ?  Yes  :  No ) <<   n ;     }     cout << flush;     return 0;   }   