#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod=1e9+7;

ll add(ll a,ll b){
  return (a+b)%mod;
}

string s;
int t[2005];

ll n;
ll A[26][2005];
ll B[26][2005];


ll mem2[2005][2005];
set<ll> T[26];

ll Counting(int l,int r){
  ll res=0;
  for(int i=0;i<26;i++){
    set<ll> :: iterator it = T[i].lower_bound(l);
    if(it != T[i].end() &&  *it <= r)res++;
  }
  return res;
}

ll solve2(int l,int r){
  if(mem2[l][r]!=-1)return mem2[l][r];

  
  ll res= Counting(l,r);
  for(int i=0;i<26;i++){
    int nl=B[i][l];
    int nr=A[i][r];

    
    if(nl+1<=nr-1){
      res=add(res, solve2(nl+1,nr-1) );
    }
  }
  return mem2[l][r]=res;
}

ll mem[2005][2005];

ll solve(int l,int r){
  if(mem[l][r]!=-1)return mem[l][r];
  if(l+1==r)return (t[l]==t[l+1]?2:1);
  
  ll res=1;
  for(int i=0;i<26;i++){
    int nl=B[i][l];
    int nr=A[i][r];
    if(nl==nr){
      continue;
    }
    if(nl+1==nr){
      res++;
      continue;
    }
    if(nl+1<=nr-1){
      res=add(res, solve(nl+1,nr-1) );
    }
  }
  return mem[l][r]=res;
}
int main(){
  memset(mem,-1,sizeof(mem));
  memset(mem2,-1,sizeof(mem2));
  cin>>s;
  
  n=s.size();
  
  for(int i=0;i<n;i++){
    t[i+1]=s[i]-'a';

    T[ t[i+1] ].insert(i+1);
  }
  
  for(int i=0;i<26;i++){
    A[i][0]=-1;
    for(int j=1;j<=n;j++){
      if(i==t[j])A[i][j]=j;
      else A[i][j]=A[i][j-1];
    }
  }

  for(int i=0;i<26;i++){
    B[i][n+1]=n+1;
    for(int j=n;j>=1;j--){
      if(i==t[j])B[i][j]=j;
      else B[i][j]=B[i][j+1];
    }
  }

  cout<< ( solve(1,n) + solve2(1,n) + mod - 1 ) %mod <<endl;
  //cout<< solve(1,n) <<endl;
  //cout<< solve2(1,n) <<endl;
  return 0;
}

