using System;
using System.Collections;
using System.Collections.Generic;


class HelloWorld
{ 
    static void Main()
    {
        string s = Console.ReadLine();
        int x = 0;
        int y = s.Length - 1;
        int d = s.Length;
        while (s[x]==s[y] && x<y)
        {
            x++;
            y--;
        }
        if (s[x] != s[y] && x + 1 == y) Console.WriteLine(2); else
        Console.WriteLine(y-x>0?y-x:1);
    }
}