Solution for Day 02
This commit is contained in:
8
day_02/first.rb
Normal file
8
day_02/first.rb
Normal file
@ -0,0 +1,8 @@
|
||||
input = File.readlines('./input')
|
||||
|
||||
a = input.map do |pwl|
|
||||
matches = pwl.match /(?<start>\d+)-(?<end>\d+) (?<char>\w): (?<pw>\w+)/
|
||||
matches[:pw].count(matches[:char]).between? matches[:start].to_i, matches[:end].to_i
|
||||
end
|
||||
puts a.count(true)
|
||||
|
Reference in New Issue
Block a user