func_code_string: #include <bits/stdc++.h>   using namespace std;   void optIO() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);   }   const long long mod = 1e9 + 7, mod2 = 998244353, mod3 = 1e9 + 9;   long long p[5020], pp = 31, hh[5020];   long long p2[5020], pp2 = 37, hh2[5020];   int dp[5020];   bool can[5020][5020];   map<long long, bool> ms;   void solve() {     int n, a, b;     cin >> n >> a >> b;     string s;     cin >> s;     p[0] = 1;     p2[0] = 1;     for (int i = 1; i < n + 1; ++i) {       p[i] = (p[i - 1] * pp) % mod;       p2[i] = (p2[i - 1] * pp2) % mod2;       hh[i] = (hh[i - 1] + (s[i - 1] -  a  + 1) * p[i]) % mod;       hh2[i] = (hh2[i - 1] + (s[i - 1] -  a  + 1) * p2[i]) % mod2;     }     for (int j = 1; j < n + 1; ++j) {       for (int i = 1; i < n + 1; ++i) {         if (i - 2 * j < 0) continue;         long long y =             ((hh[i - j] - hh[i - 2 * j] + mod) % mod * p[n - (i - j)]) % mod;         long long y2 =             ((hh2[i - j] - hh2[i - 2 * j] + mod2) % mod2 * p2[n - (i - j)]) %             mod2;         ms[y * mod2 + y2] = 1;         long long x = ((hh[i] - hh[i - j] + mod) % mod * p[n - i]) % mod;         long long x2 = ((hh2[i] - hh2[i - j] + mod2) % mod2 * p2[n - i]) % mod2;         if (ms.find(x * mod2 + x2) != ms.end()) can[i][j] = 1;       }       ms.clear();     }     for (int i = 1; i < n + 1; ++i) {       dp[i] = dp[i - 1] + a;       for (int j = 1; j < i + 1; ++j) {         if (can[i][j]) dp[i] = min(dp[i], dp[i - j] + b);       }     }     cout << dp[n] <<   n ;   }   int main() {     optIO();     int t = 1;     while (t--) {       solve();     }     return 0;   }   