[2020][ruby][6.x]
change nxsmnxpwutvkrtqzonmosntszszmulyn
commit 4895a36e90ad278e2e0d0c1573d6bbfc2a40a831
author Alpha Chen <alpha@kejadlen.dev>
date
parent ruxlwsuq
diff --git a/2020/ruby/day_06.rb b/2020/ruby/day_06.rb
new file mode 100644
index 0000000..a4f0a32
--- /dev/null
+++ b/2020/ruby/day_06.rb
@@ -0,0 +1,6 @@
+# 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