1
0
Fork 0
advent-of-code/2022/app/Main.hs
2022-12-01 08:39:35 -05:00

17 lines
381 B
Haskell

module Main (main) where
part1 :: String -> Integer
part1 str = findMax lines' [] 0
where
lines' = lines str
findMax [] acc cMax = max (sum acc) cMax
findMax ("":xs) acc cMax = findMax xs [] $ max (sum acc) cMax
findMax (x:xs) acc cMax = findMax xs ((read x):acc) cMax
main :: IO ()
main = do
contents <- getContents
putStrLn $ show $ part1 contents