#include <iostream>
//#include <fstream>
//#include <iomanip>
//#include <cmath>
//#include <algorithm>
//#include <string>
//#include <vector>
//#include <utility>
//#include <map>
//#include <ctime>
//#include <cctype>
//#include <cstdlib>
//#include <limits>
//#include <numeric>
//#include <mycpp.h>

using namespace std;

int Minimum(string t)
{
	int n = t.length();
	int br = 0;
	for(int i = 0, j = n-1; i < j; i++, j--)
	{
		if(t[i] != t[j])
		{
			return j - i;
		}
	}
	return 1;
}

int main()
{
	std::ios_base::sync_with_stdio(false);
	string t;
	cin >> t;
	cout << Minimum(t);
}