20170917_字符串翻转
//字符串翻转
//chenmeng——>gnemnehc
//abc——>cba
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
using namespace std;
class Solution
{
public:
void ReverseString(string &strSource)
{
int strLen=strSource.size();
if(strLen<1)
return;
int i=0;
int midIndex=strLen>>1;
while(i<midIndex)
{
swap(strSource[i], strSource[strLen-1-i]);
++i;
}
cout<<strSource<<endl;
}
};
int main(void)
{
string strSource;
class Solution object;
while(cin>>strSource)
{
object.ReverseString(strSource);
}
system("pause");
return 0;
}