#K51662. Reverse Integer with 32-bit Overflow Check
Reverse Integer with 32-bit Overflow Check
Reverse Integer with 32-bit Overflow Check
Given a 32-bit signed integer \( n \), reverse its digits. If the reversed integer exceeds the 32-bit signed integer range \( [-2^{31},\ 2^{31}-1] \), output 0.
The input consists of a single integer which can be positive, negative, or zero. Note that any leading zeros in the reversed integer should be omitted.
inputFormat
The input is read from standard input. It contains one line with a single integer \( n \).
outputFormat
Output to standard output a single integer which is the reverse of \( n \). If the reversed integer is out of the 32-bit signed integer range \( [-2^{31},\ 2^{31}-1] \), output 0.
## sample123
321