#C7409. Palindrome Number Check
Palindrome Number Check
Palindrome Number Check
Given a string s
that represents a number, determine whether the number is a palindrome. A number is a palindrome if it reads the same from left to right and from right to left. Note the following conditions:
- If the string
s
is empty, returnFalse
. - If the string represents a negative number (i.e. it starts with a '-'), return
False
. - If the string consists solely of zeros, it is considered a palindrome.
- Otherwise, check if the string is equal to its reverse.
Note: The input is provided via stdin
and the result should be printed to stdout
as either True
or False
.
inputFormat
A single line containing the string representation of a number. The string may include leading zeros or a minus sign.
outputFormat
Output a single line with either True or False depending on whether the number string is a palindrome according to the rules described.## sample
121
True