e40944b22d
- solve: day 6, part 1 - solve: day 6, part 2
18 lines
359 B
Haskell
Executable file
18 lines
359 B
Haskell
Executable file
#!/usr/bin/env runghc
|
|
|
|
import Day6
|
|
import Data.Set (fromList, size)
|
|
|
|
main = interact (show . solve . parse)
|
|
|
|
solve = sum . map countEveryoneYes
|
|
|
|
parse = lines'
|
|
|
|
countEveryoneYes :: [String] -> Int
|
|
countEveryoneYes group =
|
|
length $ filter everyoneYes questions
|
|
where
|
|
n = length group
|
|
questions = ['a'..'z']
|
|
everyoneYes q = all (elem q) group
|