func_code_string: #include <bits/stdc++.h>   using namespace std;   int n;   int A[101];   string s;   long long d[101][101][101];   long long f(int lo, int hi, int p) {     if (lo == hi) return A[p];     if (d[lo][hi][p]) return d[lo][hi][p];     long long ret = f(lo + 1, hi, 1) + A[p];     if (s[lo] == s[lo + 1]) ret = max(ret, f(lo + 1, hi, p + 1));     for (int i = lo + 2; i <= hi; i++)       if (s[i] == s[lo]) ret = max(ret, f(lo + 1, i - 1, 1) + f(i, hi, p + 1));     return d[lo][hi][p] = ret;   }   int main() {     cout << setprecision(10);     ios::sync_with_stdio(0);     cin.tie(0);     cin >> n;     cin >> s;     s =  #  + s;     for (int i = 1; i <= n; i++) cin >> A[i];     for (int i = 1; i <= n; i++)       for (int k = 1; k < i; k++) A[i] = max(A[i], A[i - k] + A[k]);     cout << f(1, n, 1) <<   n ;     return 0;   }   