zhangw @ 2022-09-07 21:09:48
#include <iostream>
#include <string>
using namespace std;
int main()
{
string x, y;
cin >> x;
int a = x.size();
if (a==1)
cout << x;
else if (a==2&&x[0]=='-')
cout << x;
int t;
if (x[0] != '-')
{
for (int i = 0; i < a; i++)
y[i] = x[a - i - 1];
for (t = 0; t < a; t++)
if (y[t] != 0)
{
t += 1;
break;
}
}
else
{
y[0] = '-';
for (int i = 1; i < a;i++)
y[i] = x[a - i];
for (t = 1; t < a;t++)
if (y[t]!=0)
{
t += 1;
break;}
cout << y[0];
}
for (int i = t; i < a;i++)
cout << y[i];
return 0;
}