#include<bits/stdc++.h>
using namespace std;
bool hw(string s){
	bool r=true;
	for(int i=0;i<=(s.size()-1)/2;i++){
		if(s[i]!=s[s.size()-i-1]){
			r=false;
			break;
		}
	}
	return r;
}
int main(){
	string s;
	cin>>s;
	int p=s.size();
	if(p%2==1) cout<<p;
    else{
  	  if(hw(s)){
		while(p!=0){
			p=p/2;
			s=s.substr(0,p);
			if(hw(s)==false){
				cout<<p;
				break;
			}
		}
	}else cout<<p;
  	
  } 
}
/**************************************************************
	Problem: 1134
	User: panyuchen
	Language: C++
	Result: Accepted
	Time:8 ms
	Memory:2076 kb
****************************************************************/