s = gets.chomp max = 0 ans = [''] while s =~ /([^w]+)(w+)/ if max <= $2.size if max < $2.size max = $2.size ans.clear end ans.push($1) end s = $' end puts ans