Translation

Practice this coding question on Coding Gurukul.

Problem statement

A museum has a reversible word display. One panel shows an original label and a second panel is supposed to show exactly the same letters in reverse order. The technician needs a check that catches missing, extra or incorrectly positioned letters before the display opens. This check concerns the character sequence only; it does not attempt to translate the meaning of either word. Your task Read two lowercase words s and t. Determine whether reversing all characters of s produces t exactly. If it does, print YES; otherwise print NO. Every character must be used once, and its position in t must match its reversed position in s. Important details Words of different lengths cannot qualify. An identical pair can qualify when the original word is a palindrome. Comparing only the first and last letters is not sufficient. Worked example For drawer and reward, reversing d-r-a-w-e-r gives r-e-w-a-r-d, so the required answer is YES.

Input format

Two lines containing s and t respectively.

Output format

Print YES or NO.

Constraints

1 <= length of each word <= 100; lowercase English letters only.

Sample input

drawer
reward

Sample output

YES

Sign in to run or submit a solution in C++, Java or Python.