#include using namespace std; typedef long long ll; char s[525252]; char ss[1252525]; int n,m; int mana[1252525]; int headpal[525252]; int tailpal[525252]; int main(){ scanf("%s",s); n = strlen(s); for(int i=0;i=0 && i+j=0 && i+k hps; for(int i=0;ii; if(headpal[i]==1){ hps.push_back(i+1); } } for(int i=n-1;i>0;i--){ tailpal[i-1] = tailpal[i] + (mana[n+i-1]>n-i-1); } ll ans = 0; for(int c=2;c=c)break; if(mana[c+j-1]>c-j-1)ans += rval; } } printf("%lld\n",ans); return 0; }