[NOIP2011]数字反转

#include <bits/stdc++.h>

using namespace std;

int n;

int main()
{
    cin >> n;
    if(n < 0) 
    {
        n = -n;
        cout << '-';
    }
    
    int res;
    while(n)
    {
        res = res * 10 + n % 10;
        n /= 10;
    }
    cout << res;
    
    return 0;
}