Write a function that takes a string as input and returns the string reversed.
Example:
Given s = "hello", return "olleh".
例如:
给定字符串 s = "hello" 返回"ollea"
挺简单的,没啥说的吧。。。
class Solution {
public:
string reverseString(string s) {
string ans;
int len=s.size();
for(int i=0;i<len;i++)
ans.push_back(s[s.size()-1-i]);
return ans;
}
};