// Arup Guha
// 9/2/2026
// Solution to 2026 UCF Locals Problem: Counting Necklaces

import java.util.*;

public class necklaces {

	public static void main(String[] args) {
	
		Scanner stdin = new Scanner(System.in);
		char[] s = stdin.next().toCharArray();
		int n = s.length;
		
		// oddLengthPal[i] will store lengths of odd palindromes that start at index i.
		ArrayList<Integer>[] oddLengthPal = new ArrayList[n];
		for (int i=0; i<n; i++) oddLengthPal[i] = new ArrayList<Integer>();
		
		// Same for even.
		ArrayList<Integer>[] evenLengthPal = new ArrayList[n];
		for (int i=0; i<n; i++) evenLengthPal[i] = new ArrayList<Integer>();
		
		// i is center of odd pal.
		for (int i=0; i<n; i++) {
		
			// d is distance to both ends from center.
			for (int d=0; i+d<n && i-d>=0; d++) {
				
				// Not a pal.
				if (s[i+d] != s[i-d]) break;
				
				oddLengthPal[i-d].add(2*d+1);
			}
		}
		
		// (i,i+1) is center of even pal.
		for (int i=0; i<n-1; i++) {
		
			// d is distance to both ends from left center and right center.
			for (int d=0; i+1+d<n && i-d>=0; d++) {
				
				// Not a pal.
				if (s[i+1+d] != s[i-d]) break;
				
				evenLengthPal[i-d].add(2*d+2);
			}
		}
		
		/*** The key observation here is that all triplets that work correspond to either
		     and odd palindrome by itself or and odd palindrome followed by an even one
			 or an even one followed by an odd one.
		***/
		
		long res = 0;
		
		// We are looking for an odd length pal followed by even length here.
		for (int i=0; i<n; i++) {
			
			// Odd, then even (requires rotation)
			for (Integer x: oddLengthPal[i]) {
				
				// New start index.
				int newIdx = i + x;
				
				// Avoid crashing.
				if (newIdx >= n) break;
				
				// Here is what we add.
				res += evenLengthPal[newIdx].size();
			}
		}
		
		// Now even followed by odd; even's don't count.
		for (int i=0; i<n; i++) {
			for (Integer x: evenLengthPal[i]) {
				
				// new start index.
				int newIdx = i + x;
				
				// Avoid crashing.
				if (newIdx >= n) break;
				
				// Same idea here.
				res += oddLengthPal[newIdx].size();
			}
		}
		
		// Ta da!
		System.out.println(res);
	}
}