C++
#include <algorithm>
class Solution {
public:
string reverseString(string s) {
reverse(s.begin(), s.end());
return s;
}
};
Java
public class Solution {
public String reverseString(String s) {
StringBuffer sb = new StringBuffer(s);
return sb.reverse().toString();
}
}
Python
class Solution(object):
def reverseString(self, s):
"""
:type s: str
:rtype: str
"""
return s[::-1]