def happy_day() months = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] range = (1..12) count = 0 range.each do |i| limit = months[i - 1] (1..limit).each do |j| left = j / 10 right = j % 10 count += 1 if i == left + right end end puts count end happy_day()