#C1593. Palindrome Checker

    ID: 44815 Type: Default 1000ms 256MiB

Palindrome Checker

Palindrome Checker

You are given a string s that consists of lowercase English letters and spaces. Your task is to determine whether the string is a palindrome when all spaces are ignored. In other words, after removing all spaces from the string, check if the string reads the same forward and backward.

Note: A single letter or an empty sequence of characters is considered a palindrome.

Examples:

  • racecar becomes racecar and is a palindrome so output YES.
  • hello world becomes helloworld which is not the same when reversed so output NO.

The check is performed by comparing the string (after removing spaces) with its reverse. In mathematical terms, if we denote the cleaned string as \( s' \), then the condition for the string being a palindrome is:

[ s' = \text{reverse}(s') ]

inputFormat

The input consists of a single line containing a string s composed of lowercase English letters and spaces.

outputFormat

Print YES if the string is a palindrome after ignoring spaces, otherwise print NO.

## sample
racecar
YES