func_code_string: #include <bits/stdc++.h>   using namespace std;   const int inf = 1e9 + 7;   template <class T>   void dbs(string str, T t) {     cerr << str <<   :   << t <<   n ;   }   template <class T, class... second>   void dbs(string str, T t, second... s) {     int idx = str.find( , );     cerr << str.substr(0, idx) <<   :   << t <<  ,  ;     dbs(str.substr(idx + 1), s...);   }   template <class second, class T>   ostream& operator<<(ostream& os, const pair<second, T>& p) {     return os <<  (  << p.first <<  ,   << p.second <<  ) ;   }   template <class T>   void prc(T a, T b) {     cerr <<  [ ;     for (T i = a; i != b; ++i) {       if (i != a) cerr <<  ,  ;       cerr << *i;     }     cerr <<  ] n ;   }   const int N = 2020;   long long first[N][N];   long long G[N][N];   string s;   long long g(int n, int k);   long long f(int n, int k) {     if (k < 0) return 0;     if (n == 0) return k == 0;     long long& ans = first[n][k];     if (ans != -1) return ans;     ans = 0;     int ch = s[int(s.size()) - n] -  a ;     ans = ch * f(n - 1, k) + (25 - ch) * f(n - 1, k - n) + g(n - 1, k) + (k == 0);     int nk = k;     for (int i = 1; i <= n - 1; ++i) {       int ch = s[int(s.size()) - n + i] -  a ;       nk = k - (i + 1) * (n - i);       if (nk < 0) {         for (int i = n - 1; i >= 1; --i) {           int ch = s[int(s.size()) - n + i] -  a ;           nk = k - (i + 1) * (n - i);           if (nk < 0) break;           ans += (25 - ch) * f(n - i - 1, nk);           ans %= inf;         }         break;       }       ans += (25 - ch) * f(n - i - 1, nk);       ans %= inf;     }     ans %= inf;     return ans;   }   long long g(int n, int k) {     if (k < 0) return 0;     if (n == 0) return 0;     long long& ans = G[n][k];     if (ans != -1) return ans;     int ch = s[int(s.size()) - n] -  a ;     ans = ch * f(n - 1, k) + g(n - 1, k);     ans %= inf;     return ans;   }   int main() {     ios::sync_with_stdio(0);     cin.tie(0);     int n, k;     cin >> n >> k;     memset(first, -1, sizeof first);     memset(G, -1, sizeof G);     cin >> s;     cout << f(n, k) <<   n ;     return 0;   }   