Recursion
Recursion-14
Recursion-15
Recursion-16
~/algor $ cat problems/rekursiya-palindrom-tekshirish
Palindrome string
Easy
1000 ms
64 MB
32%
You are given a string $s$ of lowercase Latin letters. Using a recursive function, determine whether the string is a palindrome (reads the same from left to right and from right to left).
Recursive condition:
- If the length of the string is $0$ or $1$ —
YES. - If the first and the last characters differ —
NO. - Otherwise check the inner substring recursively.
Input
One line with a string $s$ of lowercase Latin letters only ($1 \le |s| \le 100$).
Output
Print YES if the string is a palindrome, otherwise NO.
Note
$1 \le |s| \le 100$
Examples
Input #1
radar
Output #1
YES
Input #2
algor
Output #2
NO