Palindrome Number

Practice this coding question on Coding Gurukul.

Problem statement

A ticket archive stores signed decimal reference numbers. Before marking a reference as a mirror code, the archivist checks whether its ordinary written form looks the same when read from either direction. The sign, if present, belongs to that written form. Your task Determine whether the given integer reads identically from left to right and right to left in base ten. Do not add leading zeroes to its representation. Important details Zero is a palindrome. A negative number is not, because its minus sign is only at the beginning. Trailing zeroes matter: 10 is not a palindrome even though reversing its digits numerically gives 1. Worked example The reference 12321 reads 1, 2, 3, 2, 1 in both directions, so the answer is true. Reference 120 reads differently backward, giving false.

Input format

One signed integer x.

Output format

Print true if the condition holds, otherwise false.

Constraints

-2147483648 <= x <= 2147483647.

Sample input

12321

Sample output

true

Sign in to run or submit a solution in C++, Java or Python.