题目:
Write a function that takes a string as input and returns the string reversed.
Example:
Given s = "hello", return "olleh".
分析:
代码:
class Solution {
public:
string reverseString(string s) {
string t="";
for(int pos=s.length()-1;pos>=0;--pos)
t+=s[pos];
return t;
}
};