Reverse Words in Sentence

STRING

Problem

Create a function that takes a string and reverses the characters of each word within the string while keeping the original word order and whitespace intact.

Examples

reverseWords("Hello World") // "olleH dlroW" // Why? The characters of each word are reversed while preserving the original word order. reverseWords("Practice makes perfect") // "ecitcarP sekam tcefrep" // Why? Each word's characters are reversed.
Loading...