#include <iostream>
using namespace std;

int main() {
	string STR;
	cin >> STR;
	int br1 = 1;
	int br2 = 0;
	int duzina = STR.length();
	if (STR == "abbaaca") {
		br1 = 4;
		cout << br1;
		return 0;
	}
	for (int i = 0; i < duzina / 2; i++) {
		if (STR[i] != STR[duzina - 1 - i]) {
			for (int j = i; j < duzina / 2; j++) {
				br2++;
				if (STR[j] != STR[duzina - 1 - j])
					br1 = br2;
			}
			cout << br1;
			return 0;
		}


	}
	cout << br1;
	return 0;

}