#include <iostream>
#include <string>
using namespace std;
int HuiWenMax(string &str)
{
int len = str.size(),i;
int s,e;
int res = 1, t;
for(i=1; i<len-1; ++i)
{
t = 0;
s = i-1, e = i;
while(s>=0 && e<len)
{
if(str[s] == str[e])
{
t += 2;
s--;
e++;
}
else
break;
}
if(res < t)
res = t;
t = 1;
s = i-1, e = i+1;
while(s>=0 && e<len)
{
if(str[s] == str[e])
{
t += 2;
s--;
e++;
}
else
break;
}
if(res < t)
res = t;
}
return res;
}
int main()
{
string str;
while(cin>>str)
{
cout<<HuiWenMax(str)<<endl;
}
return 0;
}