import Numeric (showIntAtBase) import Data.Char (intToDigit) main :: IO () main = getLine >>= putStrLn . retranslate . toTwoBase . goTwo . toTenBase . translate . check check :: String -> String check ('h':'a':'m':'u':x) = ('h':'a':'m':'u':x) check _ = error "Not a number" translate :: String -> [Int] translate [] = [] translate ('h':'a':'m':'u':x) = 1 : (translate x) translate ('h':'a':'m':x) = 0 : (translate x) multiply :: Int -> Int -> Int multiply a b = a * 2 + b toTenBase :: [Int] -> Int toTenBase = foldl (multiply) 0 goTwo :: Int -> Int goTwo x = 2 * x toTwoBase :: Int -> String toTwoBase x = (showIntAtBase 2 intToDigit x "") ++ "" retranslate :: [Char] -> String retranslate x = concat [if x == '1' then "hamu" else "ham" | x <- x ]