func_code_string: #include <bits/stdc++.h>   using namespace std;   int pre[30], g[2000100], f[2000100];   char s[2000100];   int n, m, k, ans;   int main() {     scanf( %d%d , &n, &k);     scanf( %s , s + 1);     m = strlen(s + 1);     for (int i = 1; i <= m; i++) pre[s[i] -  a  + 1] = i;     n = n + m;     pre[27] = 2000000;     for (int i = m + 1; i <= n; i++) {       int mn = 27;       for (int j = 1; j <= k; j++)         if (pre[j] < pre[mn]) mn = j;       s[i] =  a  + mn - 1;       pre[mn] = i;     }     memset(pre, 0, sizeof(pre));     for (int i = 1; i <= n; i++) {       g[i] = (f[i - 1] + 1) % 1000000007;       f[i] =           ((f[i - 1] + g[i]) % 1000000007 - g[pre[s[i] -  a  + 1]] + 1000000007) %           1000000007;       pre[s[i] -  a  + 1] = i;     }     printf( %d n , (f[n] + 1) % 1000000007);     return 0;   }   