aoc2020/6.hs
2020-12-06 03:14:14 -06:00

12 lines
305 B
Haskell

import Data.List
import Data.List.Split
readlines :: FilePath -> IO [String]
readlines = fmap (splitOn "\n\n" . init) . readFile
solution2 :: [[String]] -> Int
solution2 = sum . (map $ length . foldr1 intersect)
main = do
input <- readlines "6.txt"
print (solution2 $ map (splitOn "\n") input)