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

#define ll long long

const int inf = 1e9;

int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);

	string t;
	cin >> t;
	int n = (int)t.size();

//	int ans = inf;
	int l = 0, r = n-1;
	while(t[l] == t[r] && l <= r) {
		++l;
		--r;
	}

	if (l == r) {
		cout << 1 << "\n";
		return 0;
	}
	else if (r < l) {
		cout << 1 << "\n";
	}
	else {
		cout << r - l << "\n";
	}


	return 0;
}