Skip to main content
Tuesday (24.11.2026) at 20:00: ALGOR Contest: Round #4 (Special Challenge) starts!

~/algor $ cat problems/rekursiya-palindrom-tekshirish

Palindrome string

Easy 1000 ms 64 MB 32%
Share

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:

  1. If the length of the string is $0$ or $1$ — YES.
  2. If the first and the last characters differ — NO.
  3. Otherwise check the inner substring recursively.
The outer letters of the string are compared pair by pair, moving towards the middle

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

Sign in to submit a solution

Signing up is free and takes a minute.