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. 
  2. If we split string a into two halves of the same size a1 and a2, and string b into two halves of the same size b1 and b2, then one of the following is correct: 
    1. a1 is equivalent to b1, and a2 is equivalent to b2
    2. a1 is equivalent to b2, and a2 is equivalent to b1



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!

Input

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.

Output

Print "YES" (without the quotes), if these two strings are equivalent, and "NO" (without the quotes) otherwise.

Examples

Input

aaba
abaa


Output

YES


Input

aabb
abab


Output

NO

Note

In the first sample you should split the first string into strings "aa" and "ba", the second one — into strings "ab" and "aa". "aa" is equivalent to "aa"; "ab" is equivalent to "ba" as "ab" = "a" + "b", "ba" = "b" + "a".

In the second sample the first string can be splitted into strings "aa" and "bb", that are equivalent only to themselves. That's why string "aabb" is equivalent only to itself and to string "bbaa".
//package Codeforces;
/**
 * Created by rajanW(683281)
 * Date 22-Jul-15
 * Time 8:25 PM
 * Links:
 * Remarks:
 */
import java.io.*;
import java.util.*;

//public
class Jul22_3  {

    Reader sc;
    PrintWriter out;
    String a;
    String b;

    boolean ok(int f1,int t1,int f2,int t2,char[] f,char[] s){
        boolean ans = true;
        for(int i=f1,j=f2;i<t1;i++,j++){
            if(f[i]!=s[j]){ans=false;break;}
        }
        if(ans){return true;}

        int[] hash = new int[26];
        for(int i=f1,j=f2;i<t1;i++,j++){
            hash[f[i]-'a']++;
            hash[s[j]-'a']--;
        }

        for(int i=0;i<26;i++){
            if(hash[i]!=0){return false;}
        }

        if((t1-f1)%2!=0){return false;}

        int mid = (t1-f1)/2;
        return (ok(f1,f1+mid,f2,f2+mid,f,s)&&ok(f1+mid,t1,f2+mid,t2,f,s))||
                (ok(f1,f1+mid,f2+mid,t2,f,s)&&ok(f1+mid,t1,f2,f2+mid,f,s));

    }

    boolean eq(int f1,int t1,int f2,int t2){
        if(f1>=t1||f2>=t2){return false;}
        int n = t1-f1;
        if(a.substring(f1,t1).equals(b.substring(f2,t2))){return true;}
        if(n%2!=0){return false;}

        int[] ha = new int[26];
        int[] hb = new int[26];
        for(int i=f1,j=f2;i<t1;i++,j++){
            ha[a.charAt(i)-'a']++;
            hb[b.charAt(j)-'a']++;
        }

        for(int i=0;i<26;i++){
            if(ha[i]!=hb[i]){return false;}
        }

        int mid = n/2;
        boolean a1 = eq(f1,f1+mid,f2+mid,t2)&&eq(f1+mid,t1,f2,f2+mid);
        boolean a2 = eq(f1+mid,t1,f2+mid,t2)&&eq(f1,f1+mid,f2,f2+mid);
        return (a1|a2);
    }

    void solve() throws IOException {
        a = sc.next();
        b = sc.next();
        char[] first = a.toCharArray();
        char[] second = b.toCharArray();



        int n = a.length();
       boolean ans = ok(0,first.length,0,second.length,first,second);
//               eq(0,n,0,n);
        if(ans){
            out.println("YES");
        }else{
            out.println("NO");
        }
    }


    //_______congratulation!!! main logic has ended, no need to understand what is after this line.________
    void runIO() throws Exception{
        sc = new Reader();
        out = new PrintWriter(System.out);
        solve();
        out.close();
    }

    public static void main(String[] args) throws Exception{
        new Jul22_3().runIO();
    }

    static class Reader{final private int BUFFER_SIZE=1<<16;private DataInputStream din;private byte[]buffer;private int bufferPointer,bytesRead;public Reader(){din=new DataInputStream(System.in);buffer=new byte[BUFFER_SIZE];bufferPointer=bytesRead=0;}
        public Reader(String file_name)throws IOException{din=new DataInputStream(new FileInputStream(file_name));buffer=new byte[BUFFER_SIZE];bufferPointer=bytesRead=0;}
        public String readLine()throws IOException{byte[]buf=new byte[64];int cnt=0,c;while((c=read())!=-1){if(c=='\n')
            break;buf[cnt++]=(byte)c;}
            return new String(buf,0,cnt);}
        public int nextInt()throws IOException{int ret=0;byte c=read();while(c<=' ')
            c=read();boolean neg=(c=='-');if(neg)
            c=read();do{ret=ret*10+c-'0';}while((c=read())>='0'&&c<='9');if(neg)
            return-ret;return ret;}
        public long nextLong()throws IOException{long ret=0;byte c=read();while(c<=' ')
            c=read();boolean neg=(c=='-');if(neg)
            c=read();do{ret=ret*10L+c-'0';}while((c=read())>='0'&&c<='9');if(neg)
            return-ret;return ret;}
        public double nextDouble()throws IOException{double ret=0,div=1;byte c=read();while(c<=' ')
            c=read();boolean neg=(c=='-');if(neg)
            c=read();do{ret=ret*10+c-'0';}while((c=read())>='0'&&c<='9');if(c=='.')
            while((c=read())>='0'&&c<='9')
                ret+=(c-'0')/(div*=10);if(neg)
            return-ret;return ret;}
        private void fillBuffer()throws IOException{bytesRead=din.read(buffer,bufferPointer=0,BUFFER_SIZE);if(bytesRead==-1)
            buffer[0]=-1;}
        private byte read()throws IOException{if(bufferPointer==bytesRead)
            fillBuffer();return buffer[bufferPointer++];}
        public String next()throws IOException{StringBuilder sb=new StringBuilder();byte c;while((c=read())<=' ');do{sb.append((char)c);}while((c=read())>' ');return sb.toString();}
        public int nextInt2()throws IOException{int ret=0;byte c=read();while(c<=' ')
            c=read();boolean neg=(c=='-');if(neg)
            c=read();do{ret=ret*10+c-'0';}while((c=read())>='0'&&c<='9');if(neg)
            return-ret;return ret;}
        public void close()throws IOException{if(din==null)
            return;din.close();}}
            
}