using System;

namespace _3
{
    class Program
    {
        static bool Palindrom(char[] s)
        {
            bool p = false;
            for (int i = 0; i < s.Length / 2; i++)
            {
                if (s[i] == s[s.Length - i - 1])
                    p = true;
                else
                {
                    p = false;
                    break;
                }

            }
            return p;
        }
        static void Razmeni(ref char a, ref char b)
        {
            char t = a;
            a = b;
            b = t;
        }
        static void Main(string[] args)
        {
            string s = Console.ReadLine();
            char[] c = s.ToCharArray();
            if (Palindrom(c))
                Console.WriteLine(1);
            else
            {
                char[] c1 = s.ToCharArray();
                int n = s.Length;
                for(int i = 0, j = n - 1; i < j; i++, j--)
                {
                    if (c1[i] != c1[j])
                    {
                        for(int k = 0; k < n; k++)
                        {
                            if(c1[k]==c1[i] && k != i)
                            {
                                Razmeni(ref c1[k], ref c1[j]);
                            }
                        }
                    }
                }
                if (n % 2 == 1)
                {
                    if (c1[n / 2 - 1] != c1[n / 2 + 1])
                        Razmeni(ref c1[n / 2 - 1], ref c1[n / 2]);
                    else if (!Palindrom(c1))
                    {
                        Razmeni(ref c1[n / 2 - 1], ref c1[n / 2]);
                        Razmeni(ref c1[n / 2 + 1], ref c1[n / 2]);
                    }
                }
                int l = 0;
                for (int i = 0; i < n; i++) 
                {
                    if (c[i] == c1[i])
                        l++;
                    else break;
                }
                for (int j = n-1; j > 0; j--)
                {
                    if (c[j] == c1[j])
                        l++;
                    else break;
                }
                Console.WriteLine(n - l);
            }
        }
    }
}