func_code_string: #include <bits/stdc++.h>   using namespace std;   const int N = 2000000 + 77, Mod = 1000000007, L = 30;   int n, m, k, dp[N], T[L], P[N], Ps[N], SS[L];   char S[N];   int main() {     scanf( %d %d , &n, &k);     scanf( %s , S + 1);     m = strlen(S + 1);     dp[0] = Ps[0] = 1;     for (int i = 1; i <= m; ++i) {       P[i] = T[S[i] -  a ], T[S[i] -  a ] = i;       dp[i] = (Ps[i - 1] - SS[S[i] -  a ] + Mod) % Mod;       Ps[i] = (Ps[i - 1] + dp[i]) % Mod;       SS[S[i] -  a ] = (SS[S[i] -  a ] + dp[i]) % Mod;     }     for (int i = m + 1; i <= n + m; ++i) {       int Mn = 0;       for (int j = 1; j < k; ++j)         if (T[j] < T[Mn]) Mn = j;       P[i] = T[Mn], T[Mn] = i;       dp[i] = (Ps[i - 1] - SS[Mn] + Mod) % Mod;       Ps[i] = (Ps[i - 1] + dp[i]) % Mod;       SS[Mn] = (SS[Mn] + dp[i]) % Mod;     }     printf( %d n , Ps[n + m]);     return 0;   }   