int Solution::reverse(int A) {
int check =0;
if(A<0) {
check = 1;
A = -A;
}
string str = "";
str += to_string(A);
std::reverse(str.begin(),str.end());
int res = 0;
try{
res = stoi(str);
}
catch(...){
return 0;
}
if(check)
res = -res;
return res;
}