Update all new Tasks

This commit is contained in:
Ingy döt Net 2015-02-20 09:02:09 -05:00
parent 00a190b0a6
commit 91df62d461
5697 changed files with 93386 additions and 804 deletions

View file

@ -0,0 +1,20 @@
import System.IO
isAlpha :: Char -> Bool
isAlpha = flip elem $ ['a'..'z'] ++ ['A'..'Z']
split :: String -> (String, String)
split = break $ not . isAlpha
parse :: String -> String
parse [] = []
parse l =
let (a, w) = split l
(b, x) = splitAt 1 w
(c, y) = split x
(d, z) = splitAt 1 y
in a ++ b ++ reverse c ++ d ++ parse z
main :: IO ()
main = hSetBuffering stdin NoBuffering >> hSetBuffering stdout NoBuffering >>
getContents >>= putStr . (takeWhile (/= '.')) . parse >> putStrLn "."

View file

@ -0,0 +1,31 @@
isAlpha :: Char -> Bool
isAlpha = flip elem $ ['a'..'z'] ++ ['A'..'Z']
parse :: IO ()
parse = do
x <- getChar
putChar x
case () of
_ | x == '.' -> return ()
| isAlpha x -> parse
| otherwise -> do
c <- revParse
putChar c
if c == '.'
then return ()
else parse
revParse :: IO Char
revParse = do
x <- getChar
case () of
_ | x == '.' -> return x
| isAlpha x -> do
c <- revParse
putChar x
return c
| otherwise -> return x
main :: IO ()
main = hSetBuffering stdin NoBuffering >> hSetBuffering stdout NoBuffering >>
parse >> putStrLn ""