#include <iostream>
#include <string>
#include <bits/stdc++.h>
using namespace std;
int main(){
	string t,t1,t2;
	int dinm,linm,maxin=0,poz1=0,poz2=0;
	cin>>t;
	bool pt;
	int n[26],br=0,p1,p2;
	int dk=0,lk=t.length()-1;
    while(t[dk]==t[lk]){
    	if(dk>=lk){
		cout<<1;
		return 0;
	}
	//	cout<<dk<<" "<<lk<<" ";
		dk++;
    	lk--;
   

	}  
	
	
//cout<<t[lk]<<" "<<dk<<" "<<lk<<"     ";
	if(t.length()%2==0)pt=true;
	else  pt=false;
	if(pt==true){
	 t1=t.substr(dk,t.length()/2-dk);
	 t2=t.substr(t.length()/2,lk-t.length()/2+1);
	 //cout<<"USo";
	}else{
	 t1=t.substr(dk,t.length()/2-dk);
	 t2=t.substr(t.length()/2+1,lk-t.length()/2);
  }
  string tk1=t1;
  string tk2=t2;
  
  //cout<<poz1;
  /*cout<<tk1<<endl;
  cout<<tk2<<endl;
  //cout<<t[t.length()/2]<<endl;*/
  //cout<<t.length()/2;
    for(char i='a';i<='z';i++){
	p1=count(t1.begin(),t1.end(),i);
    p2=count(t2.begin(),t2.end(),i);
/*cout<<p1<<" ";
cout<<p2<<endl;*/
	if(p1!=0 || p2!=0){
//		cout<<"uso";
	if((p1+p2)%2==0){
	if(p1>p2)dinm=(p2-p1)/2;
	else if(p2>p1)linm=(p1-p2)/2;}
	else {
	if(p1>p2)dinm=(p2-p1-1)/2;
	else if(p2>p1)linm=(p1-p2-1)/2;}
 
while(linm>=0){
poz1=tk1.rfind(i);	
    tk1.erase(poz1,0);
    linm--;
}
while(dinm>=0){
	 poz2=tk2.find(i);
    tk2.erase(poz2,0);
    dinm--;

}
cout<<poz1<<" "<<poz2<<endl;
if(maxin<abs(poz1-poz2))
maxin=abs(poz1-poz2);
}
	
	
	/*cout<<i<<p1<<" "<<i<<p2<<" ";
br++;*/

}
if(maxin==0){
	cout<<t1.length();
}else{

cout<<maxin;
}
}