Reverse the String (with a catch)

Published by persolut in

Create a function that takes a string and returns the reversed string. However there's a few rules to follow in order to make the challenge interesting:

  • The UPPERCASE/lowercase positions must be kept in the same order as the original string (see example #1 and #2).
  • Spaces must be kept in the same order as the original string (see example #3).

Examples

SpecialReverseString("Edabit") ➞ "Tibade"

SpecialReverseString("UPPER lower") ➞ "REWOL reppu"

SpecialReverseString("1 23 456") ➞ "6 54 321"

Notes

N/A

Watch a quick demo on how Edabit works.