#include <bits/stdc++.h>
using namespace std;
const int maxx = 2000 + 9;
bool ispalin[maxx][maxx];
int st[maxx];
int en[maxx];
int main() {
  string s;
  cin >> s;
  int n = (int)s.size();
  for (int i = 0; i < n; i++) {
    for (int j = i; ~j; j--) {
      if (j + 1 >= i - 1 || ispalin[j + 1][i - 1])
        ispalin[j][i] = (s[i] == s[j]);
    }
  }
  long long ans = 0;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j <= i; j++) st[i] += ispalin[j][i];
    st[i + 1] = st[i];
  }
  for (int i = n - 1; i > 0; i--) {
    int cnt = 0;
    for (int j = i; j < n; j++) cnt += ispalin[i][j];
    ans += cnt * st[i - 1];
  }
  cout << ans << endl;
  return 0;
}
