1
0
Fork 0
advent-of-code/2022/app/Main.hs

18 lines
381 B
Haskell
Raw Normal View History

2022-12-01 08:29:30 -05:00
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