#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
//---------------------------------------------------------------------------------------------------
template<int MOD> struct ModInt {
    static const int Mod = MOD; unsigned x; ModInt() : x(0) { }
    ModInt(signed sig) { x = sig < 0 ? sig % MOD + MOD : sig % MOD; }
    ModInt(signed long long sig) { x = sig < 0 ? sig % MOD + MOD : sig % MOD; }
    int get() const { return (int)x; }
    ModInt &operator+=(ModInt that) { if ((x += that.x) >= MOD) x -= MOD; return *this; }
    ModInt &operator-=(ModInt that) { if ((x += MOD - that.x) >= MOD) x -= MOD; return *this; }
    ModInt &operator*=(ModInt that) { x = (unsigned long long)x * that.x % MOD; return *this; }
    ModInt &operator/=(ModInt that) { return *this *= that.inverse(); }
    ModInt operator+(ModInt that) const { return ModInt(*this) += that; }
    ModInt operator-(ModInt that) const { return ModInt(*this) -= that; }
    ModInt operator*(ModInt that) const { return ModInt(*this) *= that; }
    ModInt operator/(ModInt that) const { return ModInt(*this) /= that; }
    ModInt inverse() const {
        long long a = x, b = MOD, u = 1, v = 0;
        while (b) { long long t = a / b; a -= t * b; std::swap(a, b); u -= t * v; std::swap(u, v); }
        return ModInt(u);
    }
    bool operator==(ModInt that) const { return x == that.x; }
    bool operator!=(ModInt that) const { return x != that.x; }
    ModInt operator-() const { ModInt t; t.x = x == 0 ? 0 : Mod - x; return t; }
};
template<int MOD> ostream& operator<<(ostream& st, const ModInt<MOD> a) { st << a.get(); return st; };
template<int MOD> ModInt<MOD> operator^(ModInt<MOD> a, unsigned long long k) {
    ModInt<MOD> r = 1; while (k) { if (k & 1) r *= a; a *= a; k >>= 1; } return r;
}
typedef ModInt<1000000007> mint;
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧  
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     
　　　　／　　　＼　 　 |　|     
　　　 /　　 /￣￣￣￣/　　|  
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿  
　 　　　＼/＿＿＿＿/　（u　⊃  
---------------------------------------------------------------------------------------------------*/




struct StringMaster {
    string S; int N;
    StringMaster() {}
    StringMaster(string s) { init(s); }

    void init(string s) {
        S = s;
        N = S.length();
    }

    // get the nearest index for the char
    vector<int> hidari[26], migi[26];
    bool isInitGo = false;
    inline void initgo() {
        if (isInitGo) return;
        isInitGo = true;
        
        

        rep(c, 0, 26) {
            migi[c].resize(N);
            migi[c][N - 1] = inf;
        }
        rrep(i, N - 2, 0) {
            rep(c, 0, 26) migi[c][i] = migi[c][i + 1];
            migi[S[i + 1]][i] = i + 1;
        }

        rep(c, 0, 26) {
            hidari[c].resize(N);
            hidari[c][0] = -1;
        }
        rep(i, 1, N) {
            rep(c, 0, 26) hidari[c][i] = hidari[c][i - 1];
            hidari[S[i - 1]][i] = i - 1;
        }
    }
    inline int gomigi(int cu, int c) { 
        initgo(); 
    return migi[c][cu]; 
    }
    inline int gohidari(int cu, int c) { initgo(); return hidari[c][cu]; }

};




string S; int N;
mint dp[2020][2020];
//---------------------------------------------------------------------------------------------------
void _main() {
    cin >> S;
    N = S.length();
    S = "a" + S + "a";
    fore(c, S) c -= 'a';

    StringMaster sm(S);

    mint ans = 0;
    dp[0][N + 1] = 1;
    rrep(len, N + 2, 2) {
        rep(L, 0, N + 1) {
            int R = L + len - 1;
            if (N + 1 < R) break;

            if (len != N + 2) ans += dp[L][R];
            rep(c, 0, 26) {
                int LL = sm.gomigi(L, c);
                int RR = sm.gohidari(R, c);

                if (LL <= RR) ans += dp[L][R];
                if (LL < RR) dp[LL][RR] += dp[L][R];
            }
        }
    }

    cout << ans << endl;
}


Measured memory_bytes: 19424