1
0
Fork 0
advent-of-code-2024/1-2.rb
2024-12-01 16:21:27 -05:00

12 lines
230 B
Ruby
Executable file

#!/usr/bin/env ruby
input = File.readlines("1.input").map(&:split)
first = input.map(&:first).compact
last = input.map(&:last).compact
result = first.map do |v|
v.to_i * last.select { _1.match?(v) }.size
end.sum
puts result