func_code_string: #include <bits/stdc++.h>   using namespace std;   template <typename T>   void chmin(T &x, const T &y) {     if (x > y) x = y;   }   template <typename T>   void chmax(T &x, const T &y) {     if (x < y) x = y;   }   inline int read() {     int x = 0, f = 1;     char ch = getchar();     while (!isdigit(ch)) {       if (ch ==  - ) f = -1;       ch = getchar();     }     while (isdigit(ch)) {       x = x * 10 + ch - 48;       ch = getchar();     }     return x * f;   }   const int N = 5000 + 10;   const int mod = 1e9 + 7;   int n, dp[N][30], len, a[N], C[N][N], ans;   signed main() {     n = read();     for (int i = 1; i <= n; i++) {       int ch;       ch = getchar() -  a  + 1;       if (ch != a[len]) a[++len] = ch;     }     C[0][0] = 1;     for (int i = 1; i <= n; i++)       for (int j = 1; j <= i; j++)         C[i][j] = (C[i - 1][j] + C[i - 1][j - 1]) % mod;     dp[0][0] = 1;     for (int i = 1; i <= len; i++)       for (int j = i; j; j--) {         int cur = a[i];         dp[j][cur] = 0;         for (int k = 0; k <= 26; k++)           if (k != cur) dp[j][cur] = (dp[j][cur] + dp[j - 1][k]) % mod;       }     for (int i = 1; i <= len; i++) {       int tmp = 0;       for (int j = 1; j <= 26; j++) tmp = (tmp + dp[i][j]) % mod;       (ans += 1LL * tmp * C[n][i] % mod) %= mod;     }     cout << ans;     return 0;     ;   }   