#include <bits/stdc++.h>
using namespace std;

int main(int argc, char** argv) {
	ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);

	string s;
	cin>>s;
 	int d = s.length();
 	int k=d;
 	
 	for(int i=0;i<d/2;i++)
 	{
 		if(s[i]==s[d-1-i])
 		{
	  	 k-=2;
	 	}
	 	else break;
	}
	if(k==0 || k==1) cout<<1;
	else cout<<k-1;
	return 0;
}