short_mo = Set{4, 6, 9, 11} cnt = 0 (1..12).each do |mm| (1..31).each do |dd| if mm == 2 && dd > 28 next end if short_mo.includes?(mm) && dd == 31 next end if mm == dd // 10 + dd % 10 cnt += 1 end end end puts cnt