import Data.List (group) main = getLine >>= putStrLn . unwords . map show . solve . init . group solve ks = [f ks, f (reverse ks)] where f cs | cs == [] = 0 | length (tc !! 1) == 2 = 1 + f (drop 4 cs) | otherwise = f (drop 4 cs) where tc = take 4 cs