#include <bits/stdc++.h>
using namespace std;
const int maxn = 2005;
char s[maxn];
long long dp[maxn], f[maxn][maxn];
bool b[maxn][maxn];
int main() {
  scanf("%s", s + 1);
  int n = strlen(s + 1);
  memset(b, 0, sizeof(b));
  memset(f, 0, sizeof(f));
  memset(dp, 0, sizeof(dp));
  for (int i = n; i >= 1; i--) {
    b[i][i] = 1;
    for (int j = i + 1; j <= n; j++)
      if (s[i] == s[j])
        if (i + 1 == j)
          b[i][j] = 1;
        else
          b[i][j] = b[i + 1][j - 1];
  }
  for (int i = n; i >= 1; i--) {
    f[i][i] = 1;
    for (int j = i + 1; j <= n; j++) f[i][j] = f[i + 1][j] + b[i][j];
  }
  for (int i = 1; i <= n; i++) {
    dp[i] = dp[i - 1];
    for (int k = 1; k < i; k++) dp[i] += f[1][k] * f[k + 1][i];
  }
  cout << dp[n] << endl;
  return 0;
}
