func_code_string: #include <bits/stdc++.h>   using namespace std;   int a, b, n, i, j;   int f[5001];   int dp[5001][5001];   char s[5003];   int main() {     while (~scanf( %d%d%d , &n, &a, &b)) {       scanf( %s , &s[1]);       for (i = 1; i <= n; i++) f[i] = f[i - 1] + a;       for (i = 1; i <= n; i++) {         f[i] = min(f[i], f[i - 1] + a);         for (j = 1; j < i; j++) {           if (s[i] == s[j]) {             dp[i][j] = dp[i - 1][j - 1] + 1;           } else             dp[i][j] = 0;           if (j <= i - dp[i][j]) {             f[i] = min(f[i], f[i - dp[i][j]] + b);           } else {             f[i] = min(f[i], f[j] + b);           }         }       }       printf( %d n , f[n]);     }   }   