This commit is contained in:
Michael Zhang 2020-12-06 03:14:14 -06:00
parent 75f30d2389
commit 7e3af57f53
Signed by: michael
GPG key ID: BDA47A31A3C8EE6B

12
6.hs Normal file
View file

@ -0,0 +1,12 @@
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)