Reverse Each Word

Difficulty:
Easy

Tags:
strings, enumerables

Instructions:
Write a method that takes a sentence and returns it with each word reversed in place.

Code:
def reverse_each_word(sentence)
 ___
end

assert_equal "olleH ,ereht dna woh era ?uoy", reverse_each_word("Hello there, and how are you?")

Your Solution

Ruby 1.9.3

Back to Problems