#include <iostream>
//#include <fstream>
//#include <iomanip>
//#include <cmath>
#include <algorithm>
//#include <string>
#include <vector>
//#include <utility>
//#include <map>
//#include <ctime>
//#include <cctype>
//#include <cstdlib>
//#include <limits>
//#include <numeric>
//#include <mycpp.h>

using namespace std;

bool Palindrom(string s)
{
	if(s.length() == 0) return false;
	if(s.length() == 1) return true;
	string t = s;
	reverse(t.begin(), t.end());
	return t == s;
}

int Minimum(string t)
{
	int grn = 0;
	for(int i = 0, j = t.length() - 1; i < j; i++, j--)
		if(t[i] != t[j])
		{
			grn++;
			for(int k = 0; !Palindrom(t.substr(i + k + 1, (j - k) - (i + k) - 1)); k++) grn++;
//			cout << "grn: " << grn << endl;
			vector<int> sl(grn, 0);
			int raz = 0;
			for(int k = 0; k < grn; k++)
			{
				sl[t[i + k] - 'a']++;
				sl[t[j - k] - 'a']--;
				if(t[i + k] != t[j - k]) raz++;
			}
//			cout << "raz: " << raz << endl;
			bool ok = true;
			for(int k = 0; k < grn; k++)
				if(sl[k] != 0)
				{
					ok = false;
					break;
				}
			if(ok)
			{  // oko palindroma su ista slova, ali u razlicitom redu
				return raz;
			}
			else
			{ // oko palindroma su razlicita slova pa se ona i palindrom moraju pomesati
				return j - i;
			}
		}
	return 1;
}

int main()
{
	std::ios_base::sync_with_stdio(false);
	string t;
	cin >> t;
	cout << Minimum(t);
}