import Control.Applicative main :: IO () main = do s <- getLine putStrLn $ solve s solve :: Ord a => [a] -> [a] solve [] = [] solve (x:xs) = solve large ++ [x] ++ solve small where small = filter (<= x) xs large = filter (> x) xs