import java.io.*;

public class tesseract_ak_n4 {
    static int solve(String s) {
        int n = s.length();
        boolean[][] pal = new boolean[n][n + 1];
        boolean[][] ok = new boolean[n][n + 1];
        for (int i = 0; i < n; i++) {
            for (int j = i + 1; j <= n; j++) {
                String ss = s.substring(i, j);
                if (isPalindrome(ss)) {
                    pal[i][j] = true;
                }
            }
        }
        for (int L = 0; L < n; L++) {
            for (int R = L + 1; R <= n; R++) {
                for (int Li = L; Li < R; Li++) {
                    for (int Ri = Li + 1; Ri <= R; Ri++) {
                        if (Li == L && Ri == R) {
                            continue;
                        }
                        ok[Li][Ri] |= pal[L][R] && pal[Li][Ri];
                    }
                }
            }
        }
        int ans = 0;
        for (boolean[] bx : ok) {
            for (boolean b : bx) {
                ans += b ? 1 : 0;
            }
        }
//        for (int i = 0; i < n; i++) {
//            for (int j = 0; j < n; j++) {
//                if (ok[i][j]) {
//                    System.err.println(i + " " + j + " " + s.substring(i, j));
//                }
//            }
//        }
        return ans;
    }

    private static boolean isPalindrome(String ss) {
        for (int i = 0; i < ss.length(); i++) {
            if (ss.charAt(i) != ss.charAt(ss.length() - i - 1)) {
                return false;
            }
        }
        return true;
    }

    public static void main(String[] args) throws IOException {
        String s = new BufferedReader(new FileReader(new File("tesseract.in"))).readLine();
        PrintWriter out = new PrintWriter("tesseract.out");
        int ans = solve(s);
        out.println(ans);
        System.err.println(ans);
        out.close();
    }
}
