#C3174. Reverse Integer Without String Conversion

    ID: 46572 Type: Default 1000ms 256MiB

Reverse Integer Without String Conversion

Reverse Integer Without String Conversion

Given an integer ( N ), your task is to reverse its digits without converting the integer into a string. If ( N ) is negative, the reversed number should also be negative. Any leading zeros in the reversed integer should be omitted. For example, if ( N=12345 ) then the output should be ( 54321 ), and if ( N=-123 ) then the output should be ( -321 ). This problem tests your ability to manipulate numbers using arithmetic operations only.

inputFormat

The input consists of a single integer ( N ) read from standard input.

outputFormat

Output the reversed integer to standard output.## sample

12345
54321