using System;

namespace _3
{
    class Program
    {
        static bool Palindrom(string 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();
            if (Palindrom(s))
                Console.WriteLine(1);
            else
            {
                int k = 0;
                int n = s.Length;
                for (int i = 0; i < n/2; i++)
                {
                    if (s[i] == s[n - 1 - i])
                        k++;
                    else break;
                }
                Console.Write(n - 2 * k - 1);
            }
        }
    }
}