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.
|
day1 = proc {|min,max,char,pass| (min..max).cover?(pass.count(char)) }
|
|
day2 = proc {|p1,p2,char,pass| [pass[p1-1], pass[p2-1]].count(char) == 1 }
|
|
puts ARGF.read.scan(/^(\d+)-(\d+)\s*(\w):\s*(\w+)$/)
|
|
.map {|a,b,c,d| [a.to_i, b.to_i, c, d] }
|
|
.count(&day2)
|