func_code_string: #include <bits/stdc++.h>   using namespace std;   const int MAX = 2e3 + 5;   string s, p;   int nxt[MAX];   vector<int> cost;   int memo[MAX][MAX];   int roll(int idx, int val) {     if (idx >= (int)cost.size()) {       return 0;     }     int &ans = memo[idx][val];     if (~ans) {       return ans;     }     ans = roll(idx + 1, val);     if (val >= (int)cost[idx]) {       ans = max(ans, roll(nxt[idx], val - cost[idx]) + 1);     }     return ans;   }   int main() {     ios_base::sync_with_stdio(false);     cin >> s >> p;     vector<pair<int, int> > ranges;     for (int i = int(0); i < int(s.size()); i++) {       int idx = 0;       int match = -1;       if (s[i] == p[0]) {         for (int j = int(i); j < int(s.size()); j++) {           if (p[idx] == s[j]) {             idx++;           }           if (idx == (int)p.size()) {             match = j;             break;           }         }       }       if (match != -1) {         ranges.emplace_back(i, match);       }     }     for (int i = int(0); i < int(ranges.size()); i++) {       auto it = lower_bound(ranges.begin(), ranges.end(),                             make_pair(ranges[i].second + 1, 0));       nxt[i] = it - ranges.begin();       cost.push_back(           max(0, ranges[i].second - ranges[i].first - (int)p.size() + 1));     }     memset(memo, -1, sizeof memo);     for (int i = int(0); i < int(s.size() + 1); i++) {       cout << min(roll(0, i), ((int)s.size() - i) / (int)p.size()) <<    ;     }     cout <<   n ;     return 0;   }   