func_code_string: #include <bits/stdc++.h>   using namespace std;   const int maxn = 4005;   int f[maxn][maxn], prea[maxn][26], preb[maxn][26];   char a[maxn], b[maxn];   int n, m, ti, td, tr, te;   int main() {     int i, j, x, y;     scanf( %d%d%d%d , &ti, &td, &tr, &te);     scanf( %s%s , a + 1, b + 1);     n = strlen(a + 1);     m = strlen(b + 1);     for (i = 1; i <= n; ++i) {       memcpy(prea[i], prea[i - 1], sizeof prea[0]);       prea[i][a[i] -  a ] = i;       f[i][0] = i * td;     }     for (i = 1; i <= m; ++i) {       memcpy(preb[i], preb[i - 1], sizeof preb[0]);       preb[i][b[i] -  a ] = i;       f[0][i] = i * ti;     }     for (i = 1; i <= n; ++i)       for (j = 1; j <= m; ++j) {         f[i][j] = min(f[i - 1][j] + td, f[i][j - 1] + ti);         f[i][j] = min(f[i][j], f[i - 1][j - 1] + (a[i] != b[j] ? tr : 0));         x = prea[i - 1][b[j] -  a ];         y = preb[j - 1][a[i] -  a ];         if (x && y)           f[i][j] = min(f[i][j], f[x - 1][y - 1] + te + (i - x - 1) * td +                                      (j - y - 1) * ti);       }     printf( %d n , f[n][m]);     return 0;   }   