#include <iostream>
#include<cstring>

using namespace std;

int main() {
	string t;
	cin >> t;
	int n = t.length() - 1, i = 0;
	while (t[i] == t[n]) {
		if (i == n || i + 1 == n) {
			cout << 1;
			return 0;
		}
		i++;
		n--;
	}
	int a = n - i;
	cout << a;

	return 0;
}