Interview Questions/Coding/Mirror Translation Check

Mirror Translation Check

Preview mode. Log in to edit, run, submit, and save progress.

Easy

Mirror Translation Check

A translation system sends a word through a mirrored channel. The received word is valid only if it is exactly the reverse of the original word. For each pair of words, decide whether the channel output is valid. Input Format: The first line contains t, the number of test cases. Each test case contains two strings. Output Format: For each test case, print YES if the second string is the reverse of the first, otherwise print NO.

Examples

Example 1
Input:
1
code edoc
Output:
YES

Explanation: The reverse of code is edoc.

Approach hint

Start with the simplest clear approach, explain the trade-off, then move toward the cleaner answer.

Common mistake

Skipping assumptions, edge cases, or trade-offs can make an otherwise good answer feel incomplete.

solution.cpp