#include <iostream>

int main() {
	std::string t;
	std::cin >> t;
	int n = t.length() / 2;

	int c = 0, s = 0, e = 0;

	for (int i = 0; i < n; i++) {
		int j = t.length() - i - 1;

		if (t[i] != t[j]) {
			if (c == 0) {
				s = i;
				e = j;
			}
			c += 2;
		}
	}

	if (t.length() % 2 != 0) {
		c++;
	}

	loop1:
	for (int i = s + 1; i < e; i++) {
		if (t[s] == t[i]) {
			c--;
			s++;
			goto loop1;
		}
	}

	loop2:
	for (int i = e - 1; i > s; i--) {
		if (t[e] == t[i]) {
			c--;
			e++;
			goto loop2;
		}
	}

	std::cout << c << std::endl;

	return 0;
}