#include <stdio.h>
#include <string.h>

const int mod = 1e9 + 7;

struct mint {
  int n;
  mint(int n_ = 0) : n(n_) {}
};

mint operator+(mint a, mint b) { return (a.n += b.n) >= mod ? a.n - mod : a.n; }
mint operator-(mint a, mint b) { return (a.n -= b.n) < 0 ? a.n + mod : a.n; }
mint operator*(mint a, mint b) { return 1LL * a.n * b.n % mod; }
mint &operator+=(mint &a, mint b) { return a = a + b; }
mint &operator-=(mint &a, mint b) { return a = a - b; }
mint &operator*=(mint &a, mint b) { return a = a * b; }

int n;
char s[2003];
mint dp[2003][2003];
int succ[2003][26];
int pred[2003][26];

int main() {
  scanf("%s", s + 1);
  s[0] = 'a';
  n = strlen(s) + 2;
  s[n - 1] = 'a';
  for (int j = 0; j < 26; j++) {
    succ[n - 1][j] = n;
    pred[0][j] = -1;
  }
  for (int i = n - 2; i >= 0; i--) {
    for (int j = 0; j < 26; j++) {
      succ[i][j] = s[i + 1] == j + 'a' ? i + 1 : succ[i + 1][j];
    }
  }
  for (int i = 1; i < n; i++) {
    for (int j = 0; j < 26; j++) {
      pred[i][j] = s[i - 1] == j + 'a' ? i - 1 : pred[i - 1][j];
    }
  }
  for (int i = 0; i < n; i++) {
    dp[i][i] = 1;
  }
  for (int d = 1; d <= n - 1; d++) {
    for (int l = 0; l + d < n; l++) {
      int r = l + d;
      if (s[l] != s[r]) continue;
      dp[l][r] += 1;
      for (int k = 0; k < 26; k++) {
        int ll = succ[l][k];
        int rr = pred[r][k];
        if (ll <= rr) {
          dp[l][r] += dp[ll][rr];
        }
        if (ll < rr) {
          dp[l][r] += 1;
        }
      }
    }
  }
  dp[0][n - 1] -= 1;
  printf("%d\n", dp[0][n - 1].n);
}

