This is my code and i get a correct result in my local computer. But it is not work here, where is the problem?

```
class Solution {
public:
int reverse(int x) {
int MAX = 2147483647;
int flag = 0;
long result = 0;
if(x<0)
{
flag = 1;
x = -x;
}
while(x>0)
{
result = result*10 + x%10;
x /=10;
}
if(result > MAX)
return 0;
else
{
if(flag == 1)
return -result;
else
return result;
}
}
};
```

Input: 1534236469

Output: 1056389759

Expected: 0