finished solution 2
parent
10794e411f
commit
7c1f6ae89c
|
@ -0,0 +1,17 @@
|
|||
#!/bin/env ruby
|
||||
|
||||
groups = Hash.new
|
||||
text = File.read('./input').strip.split("\n\n")
|
||||
|
||||
people = text.map { |t| t.count("\n") + 1 }
|
||||
|
||||
text.map!.with_index do |t, i|
|
||||
t.delete!("\n")
|
||||
t.each_char { |c| t.delete!(c) if t.count(c) != people[i] }
|
||||
t.split('').uniq.reduce(:+)
|
||||
end
|
||||
|
||||
text.compact!
|
||||
size = text.map { |t| t.length }.reduce(:+)
|
||||
|
||||
p size
|
Loading…
Reference in New Issue