At Apple, a text-processing utility needs a simple helper to reverse user-entered strings. Write a function that takes a string and returns a new string with the characters in reverse order.
ss, but in reverse orderYour solution should work for empty strings, strings with spaces, punctuation, digits, and mixed case characters.
Example 1
Input: s = "hello"
Output: "olleh"
Explanation: The characters are returned from last to first.
Example 2
Input: s = "Swift 5"
Output: "5 tfiwS"
Explanation: Spaces and digits are treated like any other character and are also reversed.
Example 3
Input: s = ""
Output: ""
Explanation: Reversing an empty string still produces an empty string.
0 <= len(s) <= 10^5s may contain letters, digits, spaces, and punctuations = "hello"Output"olleh"WhyThe characters are reversed from `h e l l o` to `o l l e h`.s = "Swift 5"Output"5 tfiwS"WhyThe digit and space are reversed along with the letters.s = "a"Output"a"WhyA single-character string is unchanged when reversed.0 <= len(s) <= 10^5s may contain letters, digits, spaces, and punctuationReturn a new reversed stringdef reverse_string(s):