summaryrefslogtreecommitdiff
path: root/2020/6.hs
blob: be4571567ca4b4d7df8fa469fd62c9abe7d72d36 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
module Main (main) where

import qualified Data.List.NonEmpty as NE
import qualified Data.Set as Set

import Input
import Util


main :: IO ()
main = do
    input <- getInput 6
    let groups = map (map Set.fromList) (NE.toList (splitOn null input))
    print (sum (map (Set.size . Set.unions) groups))
    print (sum (map (Set.size . foldl1 Set.intersection) groups))