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

namespace PalindromSafl
{
    class Program
    {
        static int metoda(string t)
        {
            for (int i = 0, j = t.Length - 1; i < j; i++, j--)
            {
                if (t[i] != t[j])
                    return j - i;
            }
            return 1;
        }
        static void Main(string[] args)
        {
            string t = Console.ReadLine();
            Console.WriteLine(metoda(t));
        }
    }
}