#include<iostream>
#include<cstdlib>
#include<string.h>
using namespace std;
int main()
{
	long long n, i,r=1,m, rez=0,prov=1,p;
	string  a;
	cin>>a;
	i=0;
	n=a.length()-1;
	m=n+1;
	while(a[i]==a[n])
	{
		i++;
		n--;
	}
	p=i;
	if(i>m/2) cout<<r;
	else {
	for (i;i<m/2;i++){
		prov--;
	if(prov==rez){
	for(int j=i+1;j<n+1;j++){
		if(a[i]==a[j]){
			rez--;
			break;
		}
	}
}
else break;
}
	cout<<n-p+1+rez;
    }
	return 0;
}