module GCJ ( process ) where getDataset filename = do fileData <- readFile filename let dataset = lines $ fileData return $ take ((read $ head dataset) :: Int) (tail dataset) processLine :: String -> Int -> (String -> String) -> String processLine input n f = "Case #" ++ (show n) ++ ": " ++ (f input) process :: String -> String -> (String -> String) -> IO () process inFile outFile f = do dataset <- getDataset inFile let result = unlines $ map (\(a,b) -> processLine a b f) (zip dataset [1..]) putStrLn result writeFile outFile result