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)
