Reverse Letters, Keep Numbers in Place

Published by Helen Yu in

Create a function that reverses letters in a string but keeps digits in their current order.

Examples

reverse("ab89c") ➞ "cb89a"

reverse("jkl5mn923o") ➞ "onm5lk923j"

reverse("123a45") ➞ "123a45"

Notes

N/A

Watch a quick demo on how Edabit works.