using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp1
{
    class Program
    {
        static int Zadatak()
        {
            string s = Console.ReadLine();
            int n = 0, d = s.Length;
            char[] a = s.ToCharArray();
            for (int i = 0; i < d / 2; i++)
            {
                if (a[i] != a[d - i - 1])
                {
                    if (a[i] == a[i + 1])
                    {
                        return d - i - 2;
                    }
                    n += 2;
                    bool t = true;
                    for (int j = i + 1; j < d - i - 1; j++)
                    {
                        if (a[i] == a[j])
                        {
                            t = false;
                            a[j] = a[d - i - 1];
                            break;
                        }
                    }
                    if (t)
                    {
                        a[i] = a[n / 2];
                    }
                }
            }
            if (n == 0)
            {
                if (s.Length % 2 == 0)
                {
                    return 2;
                }
                return 1;
            }
            return n;
        }

        static void Main(string[] args)
        {
            Console.WriteLine(Zadatak());
        }
    }
}