You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
advent-of-code/2020/ruby/day_06.rb

7 lines
262 B

# p ARGF.read.split("\n\n").map {|g| g.gsub("\n", "").chars.uniq.count }.sum
p ARGF.read.split("\n\n").map {|group|
people = group.split("\n").map(&:chars)
first = people.shift
first.count {|answer| people.all? {|answers| answers.include?(answer) }}
}.sum