import Data.Char

main = interact $ show . sol . filter (isLetter)

sol s = f n $ take n s where n = length s-2

f n s
  | t == u    = n
  | otherwise = f (n-2) $ take (n-2) s
  where
  (t,u) = splitAt (n `div` 2) s