class Solution {
public:
int reverse(int x) {
// Note: The Solution object is instantiated only once and is reused by each test case.
int newVal=0;
while(x!=0)
{
newVal=newVal*10+x%10;
x/=10;
}
return newVal;
}
};