2705. Enchanted Mirror

单点时限: 5.0 sec

内存限制: 256 MB

Alice likes two things in this world ― her mirror and her toy bricks. Alice’s toy bricks were designed to help the children to learn the alphabet, so there are some letters written on their top faces. Alice likes to play with the bricks near the mirror.

When Alice learned the alphabet, she noticed that something was wrong with her mirror! A brick in the mirror can show a different letter on it. Alice enjoyed this thing very much, and she invented a new game, trying to make some funny words from the bricks in the real world and in the mirror simultaneously.

The rules of this game are the following. Alice creates a line from some bricks that shows the word S1.

This line is shown in the mirror as some word S2, which may be different from the reflection of S1 because the mirror is enchanted. But the length of each of these words is equal to the same integer number N.

Then Alice can repeat the following step. She selects some two bricks i and j and swaps them. The reflected Alice in the mirror does exactly the same with the mirrored line, except that she of course swaps the bricks with positions N-i + 1 and N-j + 1 in it.

The goal is to create word T1 in the real world simultaneously with the word T2 in the mirror. Alice wonders whether it is possible and she asks you for help. Write a program which can determine whether the goal can be achieved.

输入格式

The input file contains four words S1, S2, T1 and T2, in this order, each on the separate line. All words have the same length N (1 ≤ N ≤ 100) and consist only of uppercase English letters.

输出格式

If the goal can be achieved, output “Yes”. Otherwise output “No”.

样例

Input
TEAM
TIED
MATE
EDIT
TEAM
MATE
TAME
MEAT
AAAA
AAAA
AAAA
AAAA
Output
Yes
No
Yes

11 人解决,22 人已尝试。

12 份提交通过,共有 54 份提交。

6.7 EMB 奖励。

创建: 12 年前.

修改: 3 年,3 月前.

最后提交: 6 年,9 月前.

来源: NEERC 2008

题目标签