#include <iostream>
#include <bits/stdc++.h>

#include <string>
using namespace std;
int main() {
	string s,L="",R="";
	cin>>s;
	int mini1,lstart,rstart,mini2,minj1,minj2,l=s.length();
	int a;
	bool postoje=false;
	mini1=0;	
	minj1=0;
	mini2=0;
	minj2=0;
	if(l!=1){
		for(a=0;a<l/2;a++){
			if(s[(l/2)-1-a]!=s[l-(l/2)+a]){
					if(mini2==0&&minj2==0){
						lstart=(l/2)-1-a;
						rstart=l-(l/2)+a;
						mini2=(l/2)-1-a;
						minj2=l-(l/2)+a;
					}
					
					mini1=mini2;
					mini2=(l/2)-1-a;
					minj1=minj2;
					minj2=l-(l/2)+a;
					
					L+=s[(l/2)-1-a];
					R+=s[l-(l/2)+a];
					postoje=true;
				}
		}	
		
	}
	else{
		cout<<1;
		return 0;
	}
	
	if(postoje){
		sort(L.begin(), L.end());
		sort(R.begin(), R.end());
		for(a=0;a<L.length();a++){	
			if(L[a]!=R[a])
				break;
			}
	}
	
	if(postoje&&L.length()==a){
		cout<<minj2-rstart+1;
	}
	else{		
		if(mini1-mini2>=minj2-minj1){
			cout<<minj2-mini1+1;
		}
		else{
			if(minj2-minj1>=mini1-mini2)
				cout<<mini2-minj1+1;
			else
				cout<<1;
		}
	}
	return 0;
}