Ուղարկել | Բոլոր լուծումները | Լավագույն լուծումները | Վերադառնալ ցուցակին |
ACM_0168 - ENCHANTED MIRROR |
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.
Input
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 and consist only of uppercase English letters.
Output
If the goal can be achieved, output "Yes". Otherwise output "No".
Examples
№ |
stdin |
stdout |
1 |
|
|
2 |
|
|
3 |
|
|
Ավելացրեց. | Հրանտ Հովհաննիսյան |
Ամսաթիվ. | 2014-04-09 |
Ժամանակի սահմանափակումը. | 1s |
Ծրագրի տեքստի սահմանափակումը. | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Լեզուներ. | Բոլորը բացի ASM32 ASM64 GAWK CLPS CLOJURE D ERL FSHARP FORTRAN GOSU HASK ICON ICK NEM NIM OBJC-CLANG PICO PIKE PYPY PYPY3 PY_NBC RUST SCM guile CHICKEN SED TCL WHITESPACE |
Աղբյուրը. | Northern QF 2008.E |