class Solution { public: int reverse(int x) { int y=abs(x); int z=0; while(y>0) { z=z*10+y%10; y=y/10; } if(x>0)return z; if(x<0)return -z; } };