require 'date' module HappyDay def solve (Date.new(2015, 1, 1) .. Date.new(2015, 12, 31)).reduce(0){|ct, d| d10, d1 = d.day.divmod(10) if d.month == d10 + d1 ct + 1 else ct end } end module_function :solve end puts HappyDay.solve