日本情報オリンピック 第5回本選 第1問 Reloaded

Write Yourself a Scheme in 48 Hoursはちょっと中断。Schemeのこと良く知らないしダメだ>自分。
もう1回情報オリンピックの問題をちゃんと解こう。こういうところは実にしつこいな>自分。

module Main (main) where

import Control.Monad (liftM)
import Data.List (sortBy)
import System.Environment

(+++) :: [Int] -> [Int] -> [Int]
(+++) = (.) (map (uncurry (+)) .) zip

count :: [String] -> [Int]
count = foldr1 (+++) . map ((map read) . words)

result :: [Int] -> String
result = tail . concatMap ((++) " " . show) . result'
  where
    result' :: [Int] -> [Int]
    result' = map fst . sortBy (\(_,x) (_,y) -> flip compare x y) . zip [1..]

main = do
    (inputFile:_) <- getArgs
    (l:ls) <- liftM lines $ readFile inputFile
    writeFile "output.txt" $ result $ count ls