
In the Capital One mobile app, some UI utilities need to display text in reverse order for debugging and formatting checks. Write a function that takes a string s and returns a new string with its characters reversed.
ss in reverse orderYour function should preserve all characters exactly as they appear, including spaces, punctuation, digits, and letter case.
Example 1
Input: s = "capital"
Output: "latipac"
Explanation: The characters are returned in reverse order.
Example 2
Input: s = "Capital One"
Output: "enO latipaC"
Explanation: Spaces are treated like any other character and are also reversed.
Example 3
Input: s = "a"
Output: "a"
Explanation: A single-character string is unchanged when reversed.
0 <= len(s) <= 10^5s may contain letters, digits, spaces, and punctuations = "capital"Output"latipac"WhyReversing the order of the characters in `capital` produces `latipac`.s = "Capital One"Output"enO latipaC"WhyAll characters, including the space, are reversed in position.s = "123!"Output"!321"WhyDigits and punctuation are treated the same as letters.0 <= len(s) <= 10^5s may contain letters, digits, spaces, and punctuationThe function should return a new reversed stringCharacter values must remain unchanged; only their order is reverseddef reverse_string(s):