#include <bits/stdc++.h>
using namespace std;
const int N = 2000 + 2;
int n;
string s;
long long dp[N][N];
long long sumL[N], sumR[N];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> s;
  n = s.size();
  s = "#" + s;
  for (int i = 1; i <= n; ++i) dp[i][i] = 1;
  for (int i = 1; i <= n; ++i)
    if (s[i - 1] == s[i]) dp[i - 1][i] = 1;
  for (int k = 2; k <= n - 1; ++k)
    for (int i = 1; i <= n - k; ++i) {
      int j = i + k;
      if (s[i] == s[j] && dp[i + 1][j - 1] != 0) dp[i][j] = 1;
    }
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= i; ++j) sumL[i] = sumL[i] + dp[j][i];
  }
  for (int i = n; i >= 1; i--) {
    for (int j = n; j >= i; j--) sumR[i] = sumR[i] + dp[i][j];
  }
  cerr << dp[1][3] << " ";
  long long res = 0;
  for (int i = 1; i <= n; ++i)
    for (int j = i + 1; j <= n; ++j) {
      res = res + 1ll * sumL[i] * sumR[j];
    }
  cout << res;
}
