The function reverses a given string by replacing each character with its corresponding character in reverse order.
