func_code_string: #include <bits/stdc++.h>   using namespace std;   const int INF = 1e9 + 7;   const int maxn = 2e6 + 5;   int n, m, k;   int last[30], dp[maxn];   char s[maxn];   int main() {     scanf( %d%d%s , &n, &k, s + 1);     m = strlen(s + 1);     n += m;     memset(last, -1, sizeof(last));     dp[0] = 1;     for (int i = (1); i <= (n); ++i) {       if (i <= m)         if (~last[s[i] -  a ])           dp[i] = (dp[i - 1] * 2 % INF + INF - dp[last[s[i] -  a ] - 1]) % INF;         else           dp[i] = dp[i - 1] * 2 % INF;       else {         int mn = 0;         for (int j = (0); j < (k); ++j)           if (last[mn] > last[j]) mn = j;         if (~last[mn])           dp[i] = (dp[i - 1] * 2 % INF + INF - dp[last[mn] - 1]) % INF;         else           dp[i] = dp[i - 1] * 2 % INF;         s[i] = mn +  a ;       }       last[s[i] -  a ] = i;     }     printf( %d n , dp[n]);     return 0;   }   