numlist = "" File.open("numlist.txt") do |file| while line = file.gets numlist << line end end max = 1 prod = 1 a = 0 b = 4 until b == numlist.length numlist[a..b].each_byte do |x| prod *= x.chr.to_i end if prod > max max = prod end prod = 1 a += 1 b += 1 end puts max