import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); char[] arr = sc.next().toCharArray(); int n = arr.length; TreeSet[] counts = new TreeSet[n]; for (int i = 0; i < n; i++) { counts[i] = new TreeSet(); } for (int i = 0; i < n; i++) { for (int j = 0; i - j >= 0 && i + j < n; j++) { if (arr[i - j] == arr[i + j]) { counts[i - j].add(j * 2 + 1); } else { break; } } for (int j = 0; i - j >= 0 && i + j + 1 < n; j++) { if (arr[i - j] == arr[i + j + 1]) { counts[i - j].add((j + 1) * 2); } else { break; } } } int[] lasts = new int[n]; lasts[n - 1] = 1; for (int i = n - 2; i >= 0; i--) { lasts[i] = lasts[i + 1]; if (counts[i].last() == n - i) { lasts[i]++; } } long total = 0; for (int x : counts[0]) { if (x >= n) { continue; } for (int y : counts[x]) { if (x + y + 1 < n) { total += lasts[x + y + 1]; } } } System.out.println(total); } }