func_code_string: #include <bits/stdc++.h>   using namespace std;   const int inf = 0x7fffffff;   const double eps = 1e-10;   const double pi = acos(-1.0);   inline int read() {     int x = 0, f = 1;     char ch;     ch = getchar();     while (ch <  0  || ch >  9 ) {       if (ch ==  - ) f = 0;       ch = getchar();     }     while (ch >=  0  && ch <=  9 ) {       x = (x << 1) + (x << 3) + (ch & 15);       ch = getchar();     }     if (f)       return x;     else       return -x;   }   const int N = 5010;   int n, a, b;   int val[N], nex[N], ans;   char s[N];   int main() {     n = read();     a = read();     b = read();     memset(val, 0x3f, sizeof(val));     val[0] = 0;     scanf( %s , s + 1);     for (int i = 1; i <= n; i++) {       val[i] = min(val[i], val[i - 1] + a);       nex[i] = i - 1;       int p = i - 1;       for (int j = i + 1; j <= n; j++) {         while (p >= i && s[j] != s[p + 1]) p = nex[p];         if (s[j] == s[p + 1]) p++;         nex[j] = p;       }       p = i - 1;       for (int j = 1; j <= i - 1; j++) {         while (p >= i && s[j] != s[p + 1]) p = nex[p];         if (s[j] == s[p + 1]) p++;         if (p >= i) val[p] = min(val[p], val[i - 1] + b);       }     }     printf( %d n , val[n]);     return 0;   }   