max = 0 crnt = 0 (gets.chomp + gets).each_char do |x| if x == 'o' crnt += 1 if crnt > max max = crnt end else crnt = 0 end end p max