#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#define popcount __builtin_popcount
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
const ll MOD=1e9+7;
string s;
int n;
int nx[26][2010], nx2[26][2010];
ll dp[2010][2010];
int main()
{
    cin>>s;
    n=s.size();
    for(int i=0; i<=n; i++){
        for(int j=0; j<26; j++){
            nx2[j][i+1]=nx2[j][i];
        }
        if(i>0) nx2[s[i-1]-'a'][i+1]=i;
    }
    for(int j=0; j<26; j++) nx[j][n+1]=n+1;
    for(int i=n; i>=0; i--){
        for(int j=0; j<26; j++) nx[j][i]=nx[j][i+1];
        if(i<n) nx[s[i]-'a'][i]=i+1;
    }
    dp[0][n+1]=1;
    ll ans=MOD-1;
    for(int i=0; i<=n; i++){
        for(int j=n+1; j>=i+1; j--){
            (ans+=dp[i][j])%=MOD;
            for(int k=0; k<26; k++){
                if(nx[k][i]<j) (ans+=dp[i][j])%=MOD;
                if(nx[k][i]<nx2[k][j]) (dp[nx[k][i]][nx2[k][j]]+=dp[i][j])%=MOD;
            }
        }
    }
    cout<<ans<<endl;
    return 0;
}
