s = "order. wrong the in are words These"s.split(/(\s+)/).reverse!.join('') # => "These words are in the wrong order."