Loading...
Loading...
Loading...
Passengers call a bus ticket lucky when its number reads the same forwards and backwards, like 1221 or 7. Read the ticket number and print Yes if it is a palindrome, otherwise No.
Yes or No.Example 1
Input
1221
Output
Yes
Same from both ends.
Example 2
Input
123
Output
No
321 is not 123.
Try the problem first. Open one hint at a time.
Reverse the number with a loop, as in "Reverse a ticket number".
The loop destroys n, so first copy it into another variable. Compare the reverse with the copy.
Write your Java code, run it on the examples and submit it to hidden tests.
Solve in the editor