To reverse a given string