#include <iostream>
#include <string>
using namespace std;
bool check(string s,int l,int r){
for(;l < r; l++,r--)
{
if(s[l] != s[r]) return false;
}
return true;
}
int main(){
string str;
cin >> str;
int len = str.size();
int maxm = 0;
for(int i = 0; i < len; i++){
for(int j = i; j < len; j++){
if(check(str,i,j)){
maxm = max(maxm,j-i+1);
}
}
}
cout<<maxm;
}
#include <string>
using namespace std;
bool check(string s,int l,int r){
for(;l < r; l++,r--)
{
if(s[l] != s[r]) return false;
}
return true;
}
int main(){
string str;
cin >> str;
int len = str.size();
int maxm = 0;
for(int i = 0; i < len; i++){
for(int j = i; j < len; j++){
if(check(str,i,j)){
maxm = max(maxm,j-i+1);
}
}
}
cout<<maxm;
}