Skip to content

Latest commit

 

History

History
20 lines (13 loc) · 709 Bytes

File metadata and controls

20 lines (13 loc) · 709 Bytes

Reverse Words

December 4 2018

You're working on a secret team solving coded transmissions.

Your team is scrambling to decipher a recent message, worried it's a plot to break into a major European National Cake Vault. The message has been mostly deciphered, but all the words are backward! Your colleagues have handed off the last step to you.

Write a method reverse_words() that takes a message as a string and reverses the order of the words in place.

For example:

message = "cake pound steal"

reverse_words(message)

puts message
# prints: "steal pound cake"

When writing your method, assume the message contains only letters and spaces, and all words are separated by one space.