Loading...
Loading...
Loading...
A word is a palindrome if it reads the same from both ends, like Madam or Noon. Read one word and print YES if it is a palindrome and NO otherwise. Capital and small letters count as the same.
YES or NO.Example 1
Input
Madam
Output
YES
m-a-d-a-m after ignoring case.
Example 2
Input
Java
Output
NO
Try the problem first. Open one hint at a time.
Change the word to lowercase first.
Compare the first and last characters, then the second and second-last, and so on. Stop as soon as one pair differs.
Write your Java code, run it on the examples and submit it to hidden tests.
Solve in the editor