敲敲敲,敲板子。
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <queue>
using namespace std;
#define ll long long
#define inf 0x3f3f3f3f
#define N 11000010
inline int read(){
int x=0,f=1;char ch=getchar();
while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
while(ch>='0'&&ch<='9') x=x*10+ch-'0',ch=getchar();
return x*f;
}
int n=0,p[N<<1],ans=0;
char s[N<<1];
int main(){
// freopen("a.in","r",stdin);
scanf("%s",s+1);n=strlen(s+1);
for(int i=n;i>=1;--i) s[i<<1]=s[i],s[i<<1|1]='#';
s[1]='#';n=n<<1|1;int id=0;
for(int i=1;i<=n;++i){
if(i<id+p[id]) p[i]=min(p[(id<<1)-i],id+p[id]-i);
else p[i]=1;
while(i-p[i]>=1&&i+p[i]<=n&&s[i-p[i]]==s[i+p[i]]) ++p[i];
if(i+p[i]>id+p[id]) id=i;
ans=max(ans,p[i]);
}printf("%d\n",ans-1);
return 0;
}