You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

14 lines
303 B
Haskell

import Data.List
import Data.List.Split
main :: IO ()
main = do
input <- splitOn "\n\n" <$> readFile "input"
print $ day6 input
day6 :: [String] -> (Int,Int)
day6 i = (c a i, c b i)
where a = nub . filter (/= '\n')
b = foldr1 intersect . lines
c p = sum . map (length . p)