main = getLine >>= putStrLn . solve solve ss = reverse $ foldl go [head ss] (zip(tail ss)ss) where go ans (now, prev) | prev /= now = now : ans | otherwise = ans