
In the Volvo Cars app, some UI utilities need to transform text before display. Write a function that takes a string s and returns a new string with its characters in reverse order.
ss in reverse order[::-1] or reversed().Example 1
Input: s = "Volvo"
Output: "ovloV"
Explanation: The characters are returned from last to first.
Example 2
Input: s = "XC40"
Output: "04CX"
Explanation: Digits and letters are reversed in the same way as any other character.
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 = "Volvo"Output"ovloV"WhyReading the characters from the end to the start gives `ovloV`.s = "XC40"Output"04CX"WhyThe last character becomes first, and the order is fully reversed.s = "a b"Output"b a"WhySpaces are characters too, so they remain in the reversed sequence.0 <= len(s) <= 10^5s may contain letters, digits, spaces, and punctuationDo not use Python slicing with [::-1] or reversed()Return a new stringdef reverse_string(s):