#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  int n = s.size();
  s = "~" + s + "/";
  vector<int> v[2012];
  for (int i = 1; i <= n; i++) {
    int l = i, r = i;
    while (s[l] == s[r]) v[l].push_back(r), --l, ++r;
  }
  for (int i = 1; i <= n - 1; i++) {
    int l = i, r = i + 1;
    while (s[l] == s[r]) v[l].push_back(r), --l, ++r;
  }
  long long homos[2012] = {};
  long long ans = 0, sum = 0;
  for (int i = 1; i <= n; i++) {
    sum += homos[i];
    ans += v[i].size() * sum;
    for (int j = 0; j < v[i].size(); j++) homos[v[i][j] + 1] += 1;
  }
  cout << ans << endl;
}
