def is_palindrome(s): return s == s[::-1] S = input() L = len(S) P, PP, PPA, PPAP = ([0] * L for _ in range(4)) for i in range(L): # PPAP for j in range(i + 1): if is_palindrome(S[j:i + 1]): PPAP[i] += PPA[j - 1] # PPA PPA[i] += sum(PP[:i]) # PP for j in range(i + 1): if is_palindrome(S[j:i + 1]): PP[i] += P[j - 1] # P if is_palindrome(S[:i + 1]): P[i] += 1 print(PPAP[-1])