#125Easy
Is it a palindrome
Time: 1 s · Memory: 256 MB
- Recursion
Statement
You are given a word. Is it a palindrome, i.e. does it read the same from left to right and from right to left? For example, kiyik is a palindrome. Check it with recursion.
Input format
A single line with a word of lowercase Latin letters, of length to .
Output format
YES if it is a palindrome, NO otherwise.
Examples
Input
kiyik
Output
YES
Input
abca
Output
NO
Note
A word is a palindrome if its first and last letters are equal and the part between them is a palindrome too. Base case: an empty or one-letter word is a palindrome. It is convenient to pass the bounds (indices and ) to the function instead of the word itself. In the second example b and c differ — NO.
