AoC/2020/day06/day06.hs

14 lines
303 B
Haskell
Raw Normal View History

2020-12-17 20:13:55 +01:00
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)