#include<bits/stdc++.h>
using namespace std;
bool hw(string s){
	bool r=true;
	for(int i=0;i<s.size();i++){
		if(s[i]!=s[s.size()-i-1]){
			r=false;
			break;
		}
	}	
	return r;
}
int main(){
   string s;
   cin>>s;
   int n=s.size();
   if(!hw(s)) cout<<n;
   else{
   	 while(n!=0){
   	   if(hw(s)){
   	   	  n=n/2; 
   	   }
	 s=s.substr(0,n);
	 if(!hw(s)) break; 
   }
   	cout<<s.size();
   	
   } 
  
   


	return 0;
}



/**************************************************************
	Problem: 1134
	User: hulaoshi
	Language: C++
	Result: Accepted
	Time:7 ms
	Memory:2076 kb
****************************************************************/