#include <iostream>
#include <string>
#include <vector>
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;

const ll MOD = 1000000007;
vector<vector<int> > calcNext(const string &S) {
    int n = (int)S.size();
    vector<vector<int> > res(n+1, vector<int>(26, n));
    for (int i = n-1; i >= 0; --i) {
        for (int j = 0; j < 26; ++j) res[i][j] = res[i+1][j];
        res[i][S[i]-'a'] = i;
    }
    return res;
}


int main(void){
    // Your code here!
    string S;
    cin >> S;
    auto ns = calcNext(S);
    string T = S;
    reverse(T.begin(), T.end());
    auto nt = calcNext(T);
    
    int N = (int)S.size();
    vector<vector<ll> > dp(N+1, vector<ll>(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++){
                if(ns[i][k] + nt[j][k] + 2 > N) continue;
                dp[ns[i][k] + 1][nt[j][k] + 1] += dp[i][j];
                dp[ns[i][k] + 1][nt[j][k] + 1] = dp[ns[i][k] + 1][nt[j][k] + 1] % MOD;
            }
        }
    }
    
    ll res = 0;
    for(int i = 0; i<= N; i++) {
        for(int j = 0; j <= N; j++){
            int num = 1;
            for(int k = 0; k < 26; k++){
                if(ns[i][k] + 1 + j <= N) num++;
                
            }
            res += (num * dp[i][j]) % MOD;
            res =  res % MOD;
        }
    }
    cout << res-1 << endl;
}

