15
txxtxttxxttxtxx
 3
myw
 127
xixtxixnxixtxixlxixtxixnxixtxixoxixtxixnxixtxixlxixtxixnxixtxixhxixtxixnxixtxixlxixtxixnxixtxixoxixtxixnxixtxixlxixtxixnxixtxix
 1
a
 10
isssisssss
 2
ff
 1
z

27824
 10
 944124121
 1
 176
 1
 1

#include <bits/stdc++.h>
using namespace std;
const int maxn = 5003;
const int mod = (int)1e9 + 7;
int dp[maxn][26], dps[maxn], un[maxn], c[maxn][maxn];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  for (int i = 0; i < maxn; ++i) c[i][0] = 1;
  for (int i = 1; i < maxn; ++i) {
    for (int j = 1; j < maxn; ++j) {
      c[i][j] = c[i - 1][j] + c[i - 1][j - 1];
      if (c[i][j] > mod) c[i][j] -= mod;
    }
  }
  int n;
  cin >> n;
  string s;
  cin >> s;
  int m = 0;
  for (int i = 0; i < n; ++i) {
    while (i + 1 != n && s[i] == s[i + 1]) ++i;
    un[++m] = s[i] - 'a';
  }
  for (int lst = 1; lst <= m; ++lst) {
    int ch = un[lst];
    dps[1] -= dp[1][ch];
    dp[1][ch] = 1;
    dps[1] += dp[1][ch];
    for (int len = 2; len <= lst; ++len) {
      dps[len] -= dp[len][ch];
      dp[len][ch] = dps[len - 1] - dp[len - 1][ch];
      if (dp[len][ch] < 0) dp[len][ch] += mod;
      dps[len] += dp[len][ch];
      if (dp[len][ch] >= mod) dp[len][ch] -= mod;
    }
  }
  int ans = 0;
  for (int len = 1; len <= m; ++len) {
    ans = ((signed long long int)ans +
           (signed long long int)dps[len] *
               (signed long long int)c[n - 1][len - 1]) %
          mod;
  }
  cout << ans << endl;
  return 0;
}
