str = gets m = str.scan(/w*/u).map{|s|s.length}.max puts str.scan(/([^w]*)w{#{m}}/u).map{|s|s.first}.select{|s|s!=""}.join("\n")