s = gets.chomp.split('') t = {} w = 0 max = 0 tmp = '' loop do if s[0] == 'w' s.shift else break end end s.each do |v| if v == 'w' w += 1 if w > max max = w end else if w != 0 if t[w].nil? t[w] = tmp else t[w] += "\n" + tmp end w = 0 tmp = v else tmp += v end end end if max > 0 if t[w].nil? t[w] = tmp else t[w] += "\n" + tmp end puts t[max].strip else puts '' end