main::IO() main = do n:m:[]<-fmap words getLine let cComp ('4','7') = GT cComp ('7','4') = LT cComp (a,b) = a `compare` b f1 (x:xs) |x ==LT = m |x ==GT = n |otherwise = f1 xs exe n m |cmp==GT = n |cmp==LT = m |otherwise = f1 . map cComp $zip n m where cmp =(length n) `compare` (length m) putStrLn $ exe n m