Today on a lecture about strings Gerald learned a new definition of string equivalency. Two strings *a* and *b* of equal length are called equivalent in one of the two cases: 
 1.  They are equal. 1.  If we split string *a* into two halves of the same size *a*<sub class="lower-index">1</sub> and *a*<sub class="lower-index">2</sub>, and string *b* into two halves of the same size *b*<sub class="lower-index">1</sub> and *b*<sub class="lower-index">2</sub>, then one of the following is correct: <ol> <li> *a*<sub class="lower-index">1</sub> is equivalent to *b*<sub class="lower-index">1</sub>, and *a*<sub class="lower-index">2</sub> is equivalent to *b*<sub class="lower-index">2</sub> 1.  *a*<sub class="lower-index">1</sub> is equivalent to *b*<sub class="lower-index">2</sub>, and *a*<sub class="lower-index">2</sub> is equivalent to *b*<sub class="lower-index">1</sub> 
As a home task, the teacher gave two strings to his students and asked to determine if they are equivalent.

Gerald has already completed this home task. Now it's your turn!
The first two lines of the input contain two strings given by the teacher. Each of them has the length from 1 to 200 000 and consists of lowercase English letters. The strings have the same length.
s1=input()
s2=input()
s11=s1[0:(len(s1)//2)]
s12=s1[(len(s1)//2):]
s21=s2[0:(len(s2)//2)]
s22=s2[(len(s2)//2):]
a11=list(s11)
a12=list(s12)
a21=list(s21)
a22=list(s22)
c1,c2,c3,c4,c5,c6,c7,c8=0,0,0,0,0,0,0,0
for el1 in a11:
    if el1 in a21:
        c1+=1
for el2 in a11:
    if el2 in a22:
        c2+=1
for el3 in a12:
    if el3 in a21:
        c3+=1
for el4 in a12:
    if el4 in a22:
        c4+=1
for el5 in a21:
    if el5 in a11:
        c5+=1
for el6 in a22:
    if el6 in a11:
        c6+=1
for el7 in a21:
    if el7 in a12:
        c7+=1
for el8 in a22:
    if el8 in a12:
        c8+=1

if((c1==len(a11) and c4==len(a12) and c1==c5 and c4==c8) or (c2==len(a11) and c3==len(a12) and c2==c6 and c3==c7)):
    print("YES")
else:
    print("NO")
