source: Codewars
Reverse a string while maintaining the spaces (if any) in their original place.
solve("our code") = "edo cruo"
-- Normal reversal withotu spaces is "edocruo".
-- However, there is a space at index 3, so the string becomes "edo cruo"
solve("your code rocks") = "skco redo cruoy".
solve("codewars") = "srawedoc".