f' :: Char -> String -> String f' c [] = [c] f' c (c' : cs) | c == c' = c : f' c cs | otherwise = [c] f :: String -> String f [] = undefined f (c : cs) = c : f' c cs main :: IO () main = do s <- getLine putStrLn (f s)