fork download
  1. -- import Control.Lens
  2. import Data.Char
  3. import Data.List
  4.  
  5. extract (x:xs) recv = extract xs $ \n s -> if '0' <= x && x <= '9' then recv (n ++ [x]) s else recv n (s ++ [x])
  6. extract [] recv = recv [] []
  7.  
  8. assemble s = extract s $ \n s -> putStrLn n >> putStrLn s
  9.  
  10. -- assemble' = mapMOf_ both putStrLn . foldl' (\a c -> a & (if isDigit c then _1 else _2) %~ cons c) ([], [])
  11. -- assemble'' = mapMOf_ both putStrLn . partition isDigit . reverse
  12.  
  13. main :: IO ()
  14. main = assemble "x51ca2yz"
  15.  
Success #stdin #stdout 0s 4540KB
stdin
Standard input is empty
stdout
215
zyacx