require 'date' def suuziwa(str) if (str.length == 1) return str.to_i end if (str.length == 2) return str[0].to_i + str[1].to_i end end head = Date.new(2015, 1, 1) tail = Date.new(2015, 12, 31) i = 0 (head..tail).each { |date| m = date.strftime('%m') d = date.strftime('%d') if (m.to_i == suuziwa(d)) i = i + 1 end } puts i.to_s + "\r\n"