s = read_line.gsub(/^w+/, "") match = s.scan(/w+/) range = match.map { |i| {i.begin.not_nil!, i.end.not_nil!} }.unshift({0, 0}) len = range.max_of { |r| r[1] - r[0] } puts range.each_with_index.to_a.select { |(r, i)| r[1] - r[0] == len }.join('\n') { |(r, i)| s[range[i - 1][1]...range[i][0]] }