#include<iostream>
#include<string>
using namespace std;
int main()
{
int a;
cin>>a;
string res;
res=to_string(a);
int len=res.size();
char * l,* r;//使用两个字符指针分别指向字符串的首位和末位
l=&res[0],r=&res[len-1];
while(l<r)//不使用额外内存,直接原地交换字符,节省内存消耗
{
char temp;
temp=*l;
*l=*r;
*r=temp;
l++;//左指针右移
r--;//右指针左移
}
cout<<res<<endl;
return 0;
} 
京公网安备 11010502036488号