string word;
cin >> word;
int i,j;
for(j=0,i=word.size()-1;j<i;--i,++j)
{
char temp=word[i];
word[i]=word[j];
word[j]=temp;
}
cout << word;
转载于:https://www.cnblogs.com/wyxy2005/archive/2012/12/27/2836180.html