import Data.List

main = do
    s<-getLine
    let n = length s
    print $ minimum $ (n:) $ map (\i->max i (n-i)) $ f 1 s (tail s)
--
f _ _ [] = []
f i (a:ar) (b:br)
    | a /= b = i : f (i+1) ar br
    | otherwise = f (i+1) ar br