#include #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+ki; } for(int i=n-1;i>0;i--){ tailpal[i-1] = tailpal[i] + (mana[n+i-1]>n-i-1); } // calc // fix PP/AP ll ans = 0; for(int c=2;c c-j-2); } ans += (ll)lval * rval; } printf("%lld\n",ans); return 0; }