#include<bits/stdc++.h>
using namespace std;
char str[230000],strtemp[230000];
int p[230000];
int len;
void Manacher()
{
len=strlen(str);
p[0]=1;
int id=0;
int mx=1;
for(int i=1;i<len;i++)
{
if(mx>i)
{
p[i]=(p[2*id-i]<(mx-i)?p[2*id-i]:(mx-i));
}
else
{
p[i]=1;
}
for(;str[i+p[i]]==str[i-p[i]]&&(i-p[i]>=0);p[i]++);
if(mx<i+p[i])
{
mx=i+p[i];
id=i;
}
}
}
int main()
{
while(~scanf("%s",strtemp))
{
len=strlen(strtemp);
for(int i=0;i<2*len+1;i++)
{
str[i]='#';
str[++i]=strtemp[i/2];
}
Manacher();
sort(p,p+len);
printf("%d\n",p[len-1]-1);
}
}