//lg 3805
//Copyright yeyou26
#include<bits/stdc++.h>
using namespace std;
int d[(int)1e8];
char ipt[(int)1e8];
char c[(int)1e8];
int n;
void init();
void Manacher();
void print();
int main()
{
freopen("working.in","r",stdin);
freopen("working.out","w",stdout);
init();
Manacher();
print();
return 0;
}
//Function Implementation
void init()
{
cin>>(ipt+1);
c[0]='$';
int k=1;
c[k]='#';
n=strlen(ipt+1);
for(int i=1;i<=n;i++)
{
c[++k]=ipt[i],c[++k]='#';
}
n=k;
}
void Manacher()
{
d[1]=1;
for(int i=2,l,r=1;i<=n;i++)
{
if(i<=r) d[i]=min(d[r-i+l],r-i+1);
while(c[i+d[i]]==c[i-d[i]]) d[i]++;
if(r<i+d[i]-1) r=i+d[i]-1,l=i-d[i]+1;
}
}
void print()
{
int mx=-1;
for(int i=1;i<=n;i++)
{
mx=max(mx,d[i]);
}
cout<<mx-1;
}