func_code_string: #include <bits/stdc++.h>   using namespace std;   int n, k, mod = 1000000007;   char t[2042];   long long dp[2042][2042], suff[2042][2042];   int solve() {     dp[n][0] = 1;     for (int cInd = n - 1; cInd >= 0; cInd--) {       dp[cInd][0] = 1;       for (int kLeft = 0; kLeft <= k; kLeft++) {         bool f = 0;         for (int d = 0; cInd + d + 1 <= n; d++) {           if (kLeft - (n - (cInd + d)) * (d + 1) >= 0) {             dp[cInd][kLeft] +=                 (1LL * dp[cInd + d + 1][kLeft - (n - (cInd + d)) * (d + 1)] *                  ( z  - t[d + cInd])) %                 mod;           } else {             f = 1;             break;           }         }         if (f) {           for (int d = n - cInd - 1; 1; d--) {             if (kLeft - (n - (cInd + d)) * (d + 1) >= 0) {               dp[cInd][kLeft] +=                   (1LL * dp[cInd + d + 1][kLeft - (n - (cInd + d)) * (d + 1)] *                    ( z  - t[d + cInd])) %                   mod;             } else {               f = 1;               break;             }           }         }         dp[cInd][kLeft] +=             (suff[cInd + 1][kLeft] + dp[cInd + 1][kLeft] * (t[cInd] -  a )) % mod;         dp[cInd][kLeft] %= mod;         suff[cInd][kLeft] += (1LL * dp[cInd + 1][kLeft] * (t[cInd] -  a ) +                               suff[cInd + 1][kLeft]) %                              mod;       }     }     return dp[0][k];   }   int main() {     cin >> n >> k;     cin >> t;     cout << solve() <<   n ;     return 0;   }   