#include<cstdio>
#include<cstring>
#include<iostream>
using namespace std;
char s[5002];
int One(int left,int len)
{
int l,r;
l=r=left;
int ans=0;
while(l>=0&&r<len&&s[l]==s[r]){
l--;
r++;
ans++;
}
return ans;
}
int Two(int left,int len)
{
int l=left;
if(left==len-1) return 0;
int r=left+1;
int ans=0;
while(l>=0&&r<len&&s[l]==s[r]){
l--;
r++;
ans++;
}
return ans;
}
int main()
{
int ans,len,i;
while(scanf("%s",s)!=EOF){
len=strlen(s);ans=0;
for(i=0;i<len;i++){
ans+=One(i,len);
ans+=Two(i,len);
}
printf("%d\n",ans);
}
return 0;
}
#include<cstring>
#include<iostream>
using namespace std;
char s[5002];
int One(int left,int len)
{
int l,r;
l=r=left;
int ans=0;
while(l>=0&&r<len&&s[l]==s[r]){
l--;
r++;
ans++;
}
return ans;
}
int Two(int left,int len)
{
int l=left;
if(left==len-1) return 0;
int r=left+1;
int ans=0;
while(l>=0&&r<len&&s[l]==s[r]){
l--;
r++;
ans++;
}
return ans;
}
int main()
{
int ans,len,i;
while(scanf("%s",s)!=EOF){
len=strlen(s);ans=0;
for(i=0;i<len;i++){
ans+=One(i,len);
ans+=Two(i,len);
}
printf("%d\n",ans);
}
return 0;
}