Taboola interview question

Reverse a string without affecting special characters (optimally)