C++#include <bits/stdc++.h>
#define 定义整型 int
#define 定义布尔 bool
#define 定义实型 double
#define 定义长整型 long
#define 流输入 cin
#define 流输出 cout
#define 程序结束返回 exit
#define 函数结束返回 return
#define 当 while
#define 重复执行 for
#define 定义字符串 string
#define 字符串长度 size
#define 主函数 main
#define 交换 swap
#define 跳过当前循环 continue
#define 如果 if
#define 否则 else
#define 零 0
#define 一 1
#define 二 2
#define 三 3
#define 四 4
#define 五 5
#define 六 6
#define 七 7
#define 八 8
#define 九 9
using namespace std;
定义整型 主函数 () {
定义字符串 字串;
定义整型 长度;
流输入 >> 字串;
长度 = 字串.字符串长度 ();
重复执行 (定义整型 变量 = 零; 变量 < 长度 / 二; 变量++) {
定义整型 反 = 长度 - 变量 - 一;
交换 (字串[变量], 字串[反]);
}
定义布尔 布尔 = 一;
如果 (长度 && 字串[长度 - 一] == '-') {
长度--;
流输出 << '-';
}
重复执行 (定义整型 变量 = 零; 变量 < 长度; 变量++) {
如果 (变量 + 一 < 长度 && 字串[变量] == '0' && 布尔) {
跳过当前循环;
}
布尔 = 零;
流输出 << 字串[变量];
}
流输出 << '\n';
函数结束返回 零;
}