//
// Written by Fyodor Menshikov 27.02.2008
// 23:07-23:19
//

import java.io.*;
import java.util.*;

class Main {

   Scanner in;
   PrintWriter out;

   Main() {
      try {
         in = new Scanner(System.in);
         out = new PrintWriter(System.out);
      } catch (Exception e) {
         throw new Error();
      }
   }

   void run() {
      // long start = System.nanoTime();
      String s = in.nextLine();
      boolean isPal[][] = new boolean[s.length()][s.length()];
      for (int len = 2; len <= s.length(); len++) {
         for (int left = 0; left + len <= s.length(); left++) {
            int right = left + len - 1;
            if (len == 2 || len == 3) {
               isPal[left][right] = s.charAt(left) == s.charAt(right);
            } else {
               isPal[left][right] =
                  isPal[left + 1][right - 1] &&
                  s.charAt(left) == s.charAt(right);
            }
         }
      }
      int count = 0;
      for (int len = 2; len <= s.length(); len++) {
         for (int left = 0; left + len <= s.length(); left++) {
            int right = left + len - 1;
            if (isPal[left][right]) {
               count++;
            } else {
               for (int mid = left + 2; mid < right; mid++) {
                  if (isPal[left][mid - 1] && isPal[mid][right]) {
                     isPal[left][right] = true;
                     count++;
                     break;
                  }
               }
            }
         }
      }
      out.println(count);
      // out.println((System.nanoTime() - start) / 1000000);
      out.close();
   }

   public static void main(String args[]) {
      new Main().run();
   }
}