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

namespace ConsoleApplication1
{
    class Program
    {
        static char Slovo_centar(string T)
        {
            char U = '2';
            for (int KP = 0; KP < T.Length; KP++)
            {
                int num = T.Count(f => (f == T[KP]));
                if (num % 2 != 0)
                {
                    U = T[KP];
                    break;
                }
            }
            return U;
        }
        static void Neparna_func(string T)
        {
            int dbg = 0, dbg2 = 0;
            string diagnosis = "";
            char CENTERLETTER = Slovo_centar(T);
            if (CENTERLETTER == T[(T.Length - 1) / 2])
            {
                for (int p = 0; p < (T.Length - 1) / 2; p++)
                {
                    if (T[0 + p] == T[T.Length - 1 - p])
                    {
                        diagnosis += "0";
                    }
                    else
                    {
                        diagnosis += "1";
                    }
                }
                if (diagnosis.Contains('1') == false)
                {
                    Console.WriteLine(1);
                    dbg2 = 1;
                }
                for (int KKK = 0; KKK < diagnosis.Length && dbg2 == 0; KKK++)
                {
                    if (diagnosis[KKK] == '1' && KKK != diagnosis.IndexOf('1'))
                    {
                        if (T[KKK] != T[diagnosis.IndexOf('1')])
                        {
                            Console.WriteLine(diagnosis.LastIndexOf('1') - diagnosis.IndexOf('1') + 1);
                            dbg = 1;
                            break;
                        }
                    }
                }
                for (int K = 0; K < diagnosis.Length && dbg == 0 && dbg2 == 0; K++)
                {
                    if (diagnosis[K] == '1')
                    {
                        Console.WriteLine((diagnosis.Length - K) * 2);
                        break;
                    }
                }
            }
            else
            {
                for (int p = 0; p < (T.Length - 1) / 2; p++)
                {
                    if (T[0 + p] == T[T.Length - 1 - p])
                    {
                        diagnosis += "0";
                    }
                    else
                    {
                        diagnosis += "1";
                    }
                }
                for (int K = 0; K < diagnosis.Length; K++)
                {
                    if (diagnosis[K] == '1')
                    {
                        Console.WriteLine((diagnosis.Length - K) * 2);
                        break;
                    }
                }
            }
        }
        static void parna_funkcija(string T)
        {
            string diagnosis = ""; int dbg = 0, dbg2 = 0;
            for (int p = 0; p < T.Length / 2; p++)
            {
                if (T[0 + p] == T[T.Length - 1 - p])
                {
                    diagnosis += "0";
                }
                else
                {
                    diagnosis += "1";
                }
            }
            if (diagnosis.Contains('1') == false)
            {
                Console.WriteLine(1);
                dbg2 = 1;
            }
            for (int KKK = 0; KKK < diagnosis.Length && dbg2 == 0; KKK++)
            {
                if (diagnosis[KKK] == '1' && KKK != diagnosis.IndexOf('1'))
                {
                    if (T[KKK] != T[diagnosis.IndexOf('1')])
                    {
                        Console.WriteLine(diagnosis.LastIndexOf('1') - diagnosis.IndexOf('1') + 1);
                        dbg = 1;
                        break;
                    }
                }
            }
            for (int K = 0; K < diagnosis.Length && dbg == 0 && dbg2 == 0; K++)
            {
                if (diagnosis[K] == '1')
                {
                    if ((diagnosis.Length - K) * 2 - 1 == 1)
                    {
                        Console.WriteLine((diagnosis.Length - K) * 2);
                    }
                    else
                    {
                        Console.WriteLine((diagnosis.Length - K) * 2 - 1);
                    }
                    break;
                }
            }
        }
        static void Main(string[] args)
        {
            string T;
            T = Console.ReadLine();
            if (T.Length % 2 == 0)
            {
                parna_funkcija(T);
            }
            else
            {
                Neparna_func(T);
            }
        }
    }
}