import Control.Monad import Data.Either import Control.Applicative if_ a b c=if a then b else c test=(.) ((flip (<*>)) Right).(flip (.)) (flip if_.Left).(flip (.)) list=[test (=='<') '>',test (=='>') '<'] change =either id (!!0).sequence.(flip fmap) list.flip id main = getLine>>=(putStrLn.reverse.fmap change)