Taboola Interview Question

Reverse a string without affecting special characters (optimally)