blob: dedd4bce930faafd6a9d210ba05eb9cc27e8eff8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
|
-- requires cabal install --lib split
module Main where
import Data.List (sort)
import Data.List.Split (splitOn)
parseAndSum :: String -> [Int]
parseAndSum = map (sum . map read . lines) . splitOn "\n\n"
main :: IO ()
main = do
input <- readFile "input"
print . sum . (take 3) . reverse . sort $ parseAndSum input
|