
B


At Slack, a text utility needs to reverse user-provided strings for formatting tests. Write a function that takes a string and returns a new string with its characters in reverse order.
ss in reverse orderYour solution should handle letters, digits, spaces, punctuation, and Unicode characters as regular characters.
Example 1
Input: s = "hello"
Output: "olleh"
Explanation: The characters are returned in the opposite order.
Example 2
Input: s = "a b!"
Output: "!b a"
Explanation: Spaces and punctuation are reversed just like letters.
0 <= len(s) <= 10^5s may contain uppercase and lowercase letters, digits, spaces, punctuation, and Unicode charactersA correct solution should run in linear time relative to the length of the string.
s = "hello"Output"olleh"WhyReversing the order of the characters in `hello` gives `olleh`.s = "a b!"Output"!b a"WhyThe space and punctuation are treated as normal characters and reversed with the rest.s = ""Output""WhyAn empty string has no characters to reverse, so the result is also empty.0 <= len(s) <= 10^5s may contain letters, digits, spaces, punctuation, and Unicode charactersThe function must return a new reversed stringdef reverse_string(s):