main :: IO ()
main = getLine >>= print . solve 

solve :: String -> Int 
solve xs = checks len len 1 xs
    where
        len = length xs

checks :: Int -> Int -> Int -> String -> Int
checks acc len i (x : y : zs)
    | x /= y = checks (min acc . max i $ len - i) len (i + 1) $ y : zs
    | otherwise = checks acc len (i + 1) $ y : zs
checks acc _ _ _ = acc
