#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
const int MOD = (int)1e9 + 7;

vector<vector<int>> calc_next(const string &s) {
    int n = s.size();
    vector<vector<int>> nxt(n + 1, vector<int>(26, n));
    for (int i = n - 1; i >= 0; i--) {
        for (int j = 0; j < 26; j++) nxt[i][j] = nxt[i + 1][j];
        nxt[i][s[i] - 'a'] = i;
    }
    return nxt;
}

int main() {
    string s; cin >> s;
    string t = s; reverse(t.begin(), t.end());
    auto ns = calc_next(s);
    auto nt = calc_next(t);
    int n = s.size();
    vector<vector<long long>> dp(n + 1, vector<long long>(n + 1, 0));
    dp[0][0] = 1;
    for (int i = 0; i < n; i++) for (int j = 0; j < n; j++) {
        for (int k = 0; k < 26; k++) {
            int ni = ns[i][k] + 1, nj = nt[j][k] + 1;
            if (ni + nj > n) continue;
            (dp[ni][nj] += dp[i][j]) %= MOD;
        }
    }
    long long res = 0;
    for (int i = 0; i <= n; i++) {
        for (int j = 0; i + j <= n; j++) {
            int cnt = 1;
            for (int k = 0; k < 26; k++) if (ns[i][k] + 1 + j <= n) cnt++;
            (res += dp[i][j] * cnt % MOD) %= MOD;
        }
    }
    cout << res - 1 << endl;
    return 0;
}
