count :: [Char] -> Int
count s = let y = length $ fst x in if snd x then y else y-1
    where x = foldl step ([], True) s

step :: ([String], Bool) -> Char -> ([String], Bool)
step ([], _) c = ([[c]], True)
step ((x:ys), False) c = (((c:x):ys), True)
step ((x:ys), True) c | x == [c] = (([c]:x:ys), False)
                      | otherwise = (([c]:x:ys), True)

main = do
  s <- getLine :: IO String
  putStrLn . show $ count s
