/************************************
 *  Event  :      Programming olympad, Vologda 2008
 *  Problem:      Super Palindroms
 *  Author:       Pavel Kuznetsov
 *  Last update:  2008.02.28 22:52
 ************************************
*/

#include <map> 
#include <set> 
#include <queue> 
#include <bitset> 
#include <valarray> 
#include <complex> 
#include <iostream> 
#include <sstream> 
#include <cmath> 
#include <algorithm> 
#include <string>
#include <string.h>
#include <stdio.h>
#include <cassert> 

using namespace std;

// prewritten code

#define Size(x) (int)(x).size()
#define For(i,a,b) for(int i=(int)(a);i<=(int)(b);++i)
#define Ford(i,a,b) for(int i=(int)(a);i>=(int)(b);--i) 
#define RepV(i,v) for (int i=0;i<Size(v);++i)
#define All(c) (c).begin(),(c).end()
#define Fill(a,b) memset(&a,b,sizeof(a))
#define Min(a,b) ((a)<(b)?(a):(b))
#define Max(a,b) ((a)>(b)?(a):(b))
#define Abs(a) ((a)<0?-(a):(a))
#define VVI vector<vector<int> >
#define VI vector<int>
#define VVS vector<vector<string> >
#define VS vector<string>
#define ForEach(it,a) for (typeof((a).begin()) it=(a).begin(); it!=(a).end(); ++it)
#define DBG(x) cout << #x <<" = "<< x << endl;
#define DBGA(x) {cout << #x <<": "; for (int i=0; i<(int)sizeof(x)/(int)sizeof(x[0]); ++i) cout<<x[i]<<' '; cout<<endl;}
#define DBGV(x) {cout << #x <<": "; for (int i=0; i<(int)Size(x); ++i) cout<<x[i]<<' '; cout<<endl;}

const string problem_name = "superpal";
const int MAXN = 1000;

int sp[MAXN][MAXN];
char s[MAXN+2];
int n;
int res;

int main(){
//	freopen((problem_name+".in").c_str(),"rt",stdin);
//	freopen((problem_name+".out").c_str(),"wt",stdout);
	
	// Input
	
	gets(s);
	
	// Check input
	
	n = strlen(s);
	assert( n >= 1 && n <= MAXN);
	
	For(i,0,n-1) assert(s[i] >= 'a' && s[i] <= 'z');
	
	// Solve
	
	For(l,2,n) For(i,0,n-l) res += sp[i][i+l-1] = l<4 ? s[i] == s[i+l-1] : s[i] == s[i+l-1] && sp[i+1][i+l-2];
	For(l,4,n) For(i,0,n-l) For(j,2,l-2) if (!sp[i][i+l-1] && sp[i][i+j-1] && sp[i+j][i+l-1]) {res += sp[i][i+l-1] = 1; break;}
	
	// Output
	
	cout << res;
	
	return 0;
}
