This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
#include <bits/stdc++.h>
using namespace std;
int n;
int main() {
cin >> n;
//特判
if (n == 0) {
printf("0");
exit(0);
}
//如果是负数,输出负号
if (n < 0) n = -n, printf("-");
//数位分离
bool flag = false;//是否出现过非零数字
//示例: 800 --->8
//示例2: 8001 --->1008
//示例3:108001 --->100801
while (n) {
int a = n % 10;
n /= 10;
//出现过非0数字
if (a == 0 && !flag) continue;
else if (!flag) flag = true;
cout << a;
return 0;