Amazon Interview Question

Q. reverse a string keeping special characters at same position ie as$d% to ds$a%