func_code_string: #include <bits/stdc++.h>   using namespace std;   int countBits(long long mask) {     int res = 0;     while (mask) mask &= (mask - 1), ++res;     return res;   }   string toString(long long n) {     stringstream ss;     ss << n;     return ss.str();   }   long long toNumber(string s) {     stringstream ss;     long long n;     ss << s;     ss >> n;     return n;   }   bool palindrome[2001][2001];   int Start[2001], End[2001], cumEnd[2001];   int main() {     string str;     while (cin >> str) {       memset(Start, 0, sizeof Start);       memset(End, 0, sizeof End);       memset(palindrome, 0, sizeof palindrome);       for (int i = (int)(0), _m = (int)(str.size()); i < _m; ++i) {         palindrome[i][i] = true;         if (i && str[i] == str[i - 1]) palindrome[i - 1][i] = true;       }       for (int len = (int)(3), _m = (int)(str.size()); len < _m; ++len)         for (int i = (int)(0), _m = (int)(str.size()); i < _m; ++i)           if (len + i - 1 >= str.size())             break;           else             palindrome[i][i + len - 1] =                 (str[i] == str[i + len - 1]) && palindrome[i + 1][i + len - 2];       for (int i = (int)(0), _m = (int)(str.size()); i < _m; ++i) {         for (int j = (int)(i), _m = (int)(str.size()); j < _m; ++j)           Start[i] += palindrome[i][j];         for (int j = (int)(0), _m = (int)(i + 1); j < _m; ++j)           End[i] += palindrome[j][i];         cumEnd[i] = End[i] + (!i ? 0 : cumEnd[i - 1]);       }       long long res = 0;       for (int i = (int)(1), _m = (int)(str.size()); i < _m; ++i)         res += (long long)Start[i] * cumEnd[i - 1];       cout << res << endl;     }   }   