#include <iostream>
#include <algorithm>
#include <string>
#include <vector>

using namespace std;

int main()
{
	string t; //Rec koja se unosi
	string r;
	//int brojac;

	getline(cin, t);
	int duzina = t.size();
	vector<string> s(duzina);

	for (int i = 0; i < t.size(); i++)
	{
		s[i] = t[i];
	}

	for (int i = 0; i <= s.size(); i++)
	{
		if (s.front() == s.back())
		{
			s.pop_back();
			s.erase(s.begin());
		}
	}
	int duznew = s.size();
	int dup = 0;
	int dupn = 0;
	int nm = 0;

	for (int i = 0; i < s.size() - 1; i++)
	{
		for (int n = i + 1; n < s.size() - 1; n++)
		{
			if (s.front() == s[i])
			{
				dup++;
			}
			else if (s[i] == s[n])
			{
				dupn++;
			}
		}
		if (dupn % 2 == 1)
		{
			nm++;
		}
	}

	if (dup % 2 == 0)
	{
		duznew -=(dup / 2);
		cout << duznew << endl;
	}
	else if (nm > 1)
	{
		cout << 0 << endl;
	}
	else
	{
		duznew -= ((dup - 1) / 2);
		cout << duznew << endl;
	}

	return 0;
}