main :: IO()
main = do
  s <- getLine
  print $ slv (tail s) $ show (head s)

slv :: String -> String -> Integer
slv s tmp | success = val
          | otherwise = slv (tail s) (tmp ++ (show (head s)))
  where (success, val) = slv' s tmp "" 1 True

slv' :: String -> String -> String -> Integer -> Bool -> (Bool, Integer)
slv' [] _ _ ret chk = (chk, ret) 
slv' (s:ss) before now ret chk | (now ++ show s) == before = slv' ss before (now ++ show s) ret False
                               | otherwise = slv' ss (now ++ show s) "" (ret + 1) True