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

int main(int argc, char const *argv[])
{
	string s;
	cin >> s;
	unordered_map<char, int> mapi;
	for (const auto& c : s) {
		mapi[c]++;
	}
	int l = 0, r = s.length() - 1;
	for (int i = 0; i < s.length() / 2; i++) {
		auto& a = mapi[s[l]];
		auto& b = mapi[s[r]];
		if (s[l] == s[r]) {
			//cout << "Both" << " " << s[l] << endl;
			l++;
			r--;

			a--;
			b--;
			continue;
		}
		if (a > 1) {
			//cout << "A" << " " << s[l]  << " " << a << endl;
			a--;
			l++;
		}
		if (b > 1) {
			//cout << "B" << " " << s[r] << endl;
			b--;
			r--;

		}
	}
	int ans  = r - l;
	if (ans < 1) {
		ans = 1;
	}
	cout << ans << endl;
	return 0;
}