#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <vector>
#include <algorithm>
#include <iostream>
#include <string>
#include <string.h>

int main()
{
	std::string original_input;
    std::string input;
    std::getline(std::cin, input);

	original_input = input;

	int n = input.length();
	auto fix_palindrome = [&]()
	{
		int count = 0;
		for(int i = 0; i < n / 2; i++) 
		{
			int left = i;
			int right = n-left-1;
			while(left < right) 
			{
				if(input[left] == input[right]) break;
				else right--;
			}
			
			if(left == right) 
			{
				count = -1;
			}
			
			for(int j = right; j < n-left-1; j++) 
			{
				char c = input[j];
				input[j] = input[j+1];
				input[j+1] = c;
				count++;
			}
		}
		return count;
		
	};
	fix_palindrome();
	fix_palindrome();

	int p = -1;
	int q = -1;
	std::vector<int> pos;
	for(int i = 0; i < n / 2 + ((n % 2 == 1) ? 1 : 0); i++)
	{
		int j = n-1-i;
		if(n % 2 == 1 && i == n / 2)
		{
			if(original_input[i] != input[i]) 
			{
				pos.push_back(i);
				if(p == -1) p = i;
				else if(q == -1) q = i;
			}	
		}
		else if(original_input[i] == original_input[j]) continue; // isti su znakovi, sve je u redu

		if(original_input[i] != input[i]) 
		{
			pos.push_back(i);
		}
		if(original_input[j] != input[j]) 
		{
			pos.push_back(j);
		}
	}
	if(pos.size() == 0) printf("1\n");
	else printf("%d\n", 1 + *std::max_element(pos.begin(), pos.end()) - *std::min_element(pos.begin(), pos.end()));

    return 0;
}