Skip to content

Latest commit

 

History

History

reversingWordsInAString

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

Reversing Words in a String

8 kyu link to kata
my solution

You need to write a function that reverses the words in a given string. A word can also fit an empty string. If this is not clear enough, here are some examples:

As the input may have trailing spaces, you will also need to ignore unneccesary whitespace.

Example (Input --> Output)

"Hello World" --> "World Hello"
"Hi There." --> "There. Hi"