#include <bits/stdc++.h>
	#define ll unsigned long long
	
	using namespace std;
	
	int main() {
	    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
	   string s;
	   cin >> s;
	   bool mark[s.length() / 2] = {false};
	   for(int i = 0; i < s.length() / 2; i++) {
			if(s[i] != s[s.length() - 1 - i]) mark[i] = true;
	   }
	   bool is = false;
	   bool in = false;
	   int wer, man;
	   for(int i = 0; i < s.length() / 2; i++) {
	   		if(mark[i]) {
	   			if(!is) wer = i;
	   			is = true;
	   			man = i;
		   	}
	   }
	   if(!is) {
	   	cout << 1;
	   	return 0;
	   }
	   string l = "", d = "";
	   for(int i = 0; i < s.length() / 2; i++) {
	   	if(mark[i]) {
	   		l += s[i];
	   		d += s[s.length() - 1 - i];
		   }
	   }
	   sort(l.begin(), l.end());
	   sort(d.begin(), d.end());
	   if(l == d) {
	   	cout << -wer + man + 1;
	   	return 0;
	   }
	   else if(s.length() % 2 == 0) {
	   	cout << s.length() - 2 * wer;
	   	return 0;
	   }
	   int le, de;
	   string w = s.substr(wer, s.length() / 2 - wer + 1);
	   string q = s.substr(s.length() / 2, s.length() / 2 - wer + 1);
	   vector<char> needle, needde;
	   le = w.length();
	   de = q.length();
	   sort(w.begin(), w.end());
	   for(int i = 0; i < le; i++) {
	   	bool u = binary_search(w.begin(), w.end(), q[i]);
	   	if(!u) {
	   		needle.push_back(q[i]);
		}
		bool y = binary_search(q.begin(), q.end(), w[i]);
		if(!y) {
			needde.push_back(w[i]);;
		}
	   }
	   sort(needle.begin(), needle.end());
	   sort(needde.begin(), needde.end());
	   if(needle.empty()) {
	   	cout << le;
	   	return 0;
	   }
	   if(needde.empty()) {
	   	cout << de;
	   	return 0;
	   }
	   int desi = needde.size();
	   int lesi = needle.size();
	   bool visitedd[desi] = {false};
	   bool visitedl[lesi] = {false};
	   for(int i = 1; i < s.length() / 2 - wer + 1; i++) {
	   	if(lesi == 0) break;
	   	bool u = binary_search(needle.begin(), needle.end(), s[s.length() / 2 + i]);
	   	if(u) {
	   		auto x = lower_bound(needle.begin(), needle.end(), s[s.length() / 2 + i]);
	   		int p = x - needle.begin();
	   		int brb = 0;
	   		while(needle[p + brb] == s[s.length() / 2 + i]) {
	   			if(!visitedl[p + brb]) {
			   		lesi--;
			   		visitedl[p + brb] = true;
			   		break;
				   }
			   }
	   		int br = brb + 1;
			   while(needle[p + br] == s[s.length() / 2 + i])	{
			   	if(!visitedl[p + br]) {
			   		lesi--;
			   		visitedl[p + br] = true;
			   		break;
				   }
			   }
		}
	   	le++;
	   }
	   for(int i = 1; i < s.length() / 2 - wer + 1; i++) {
	   	if(desi == 0) break;
	   	bool u = binary_search(needde.begin(), needde.end(), s[s.length() / 2 - i]);
	   	if(u) {
	   		auto x = lower_bound(needde.begin(), needde.end(), s[s.length() / 2 - i]);
	   		int p = x - needde.begin();
	   		int brb = 0;
	   		while(needde[p + brb] == s[s.length() / 2 - i]) {
	   			if(!visitedd[p + brb]) {
			   		desi--;
			   		visitedd[p + brb] = true;
			   		break;
				   }
			   }
	   		int br = brb + 1;
			   while(needde[p + br] == s[s.length() / 2 - i])	{
			   	if(!visitedd[p + br]) {
			   		desi--;
			   		visitedd[p + br] = true;
			   		break;
				   }
			   }
		}
	   	de++;
	   }
	   cout << min(le, de);
	    return 0; 
	}