import java.io.*;
import java.util.*;

public class Practise {

    public static void main(String[] args)throws IOException {
         Scanner sc= new Scanner(System.in);
        PrintWriter w= new PrintWriter(System.out);

     try {
    	 String s1=sc.next();
    	 String s2=sc.next();

    	if(eq(s1,s2)) {
    		w.println("YES");
    	}
    	else {
    		w.println("NO");
    	}

    	w.close();
     }catch(Exception e) {

     }
    }
    static boolean eq(String a,String b) {
    	if(a.length()==1||a.equals(b))
    		return a.equals(b);
//    	if(a.length()%2!=0)
//    		return false;
    	String a1=a.substring(0, a.length()/2);
    	String a2=a.substring(a.length()/2);
    	String b1=b.substring(0, b.length()/2);
    	String b2=b.substring(b.length()/2);
    	//System.out.println(a1+" "+a2+" "+b1+" "+b2);
    		return (eq(a1,b1)&&eq(a2,b2))||(eq(a2,b1)&&eq(a1,b2));

    }

    static class Reader   // here reader class is defined.
    {
        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]; // line length
            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 * 10 + 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 void close() throws IOException
        {
            if (din == null)
                return;
            din.close();
        }
    }

}


import java.io.*;
import java.util.*;

public class Practise {

    public static void main(String[] args)throws IOException {
         Scanner sc= new Scanner(System.in);
        PrintWriter w= new PrintWriter(System.out);

     try {
    	 String s1=sc.next();
    	 String s2=sc.next();

    	if(isEqual(s1,s2)) {
    		w.println("YES");
    	}
    	else {
    		w.println("NO");
    	}

    	w.close();
     }catch(Exception e) {

     }
    }
    static boolean isEqual(String s1,String s2) {
    	if(s1.equals(s2)) {
    		return true;
    	}
    	int n1=s1.length();
    	int n2=s2.length();
    	String a1=s1.substring(0, n1/2);
    	String a2=s1.substring(n1/2,n1);
    	String b1=s2.substring(0, n2/2);
    	String b2=s2.substring(n2/2,n2);
    	char a11[]=a1.toCharArray();
    	char a22[]=a2.toCharArray();
    	char b11[]=b1.toCharArray();
    	char b22[]=b2.toCharArray();
    	Arrays.sort(a11);
    	Arrays.sort(b11);
    	Arrays.sort(a22);
    	Arrays.sort(b22);
    	boolean check=true;
    	if(a11.length==b22.length) {
    		for(int i=0;i<a11.length;i++) {
    			if(a11[i]!=b22[i]) {
    				check=false;
    				return check;
    			}
    		}
    	}else {
    		return false;
    	}
    	if(b11.length==a22.length) {
    		for(int i=0;i<a11.length;i++) {
    			if(b11[i]!=a22[i]) {
    				check=false;
    				return check;
    			}
    		}
    	}else {
    		return false;
    	}

    	return check;
    }

    static class Reader   // here reader class is defined.
    {
        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]; // line length
            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 * 10 + 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 void close() throws IOException
        {
            if (din == null)
                return;
            din.close();
        }
    }

}


import java.io.*;
import java.util.*;

public class Practise {

    public static void main(String[] args)throws IOException {
         Scanner sc= new Scanner(System.in);
        PrintWriter w= new PrintWriter(System.out);

     try {
    	 String s1=sc.next();
    	 String s2=sc.next();

    	if(isEqual(s1,s2)) {
    		w.println("YES");
    	}
    	else {
    		w.println("NO");
    	}

    	w.close();
     }catch(Exception e) {

     }
    }
    static boolean isEqual(String s1,String s2) {
    	if(s1.equals(s2)) {
    		return true;
    	}
    	int n1=s1.length();
    	int n2=s2.length();
    	String a1=s1.substring(0, n1/2);
    	String a2=s1.substring(n1/2,n1);
    	String b1=s2.substring(0, n2/2);
    	String b2=s2.substring(n2/2,n2);
    	Hashtable<Character,Integer>tbl1= new Hashtable<Character, Integer>();
    	Hashtable<Character,Integer>tbl2= new Hashtable<Character, Integer>();
    	for(int i=0;i<a1.length();i++) {
    		if(tbl1.get(a1.charAt(i))==null) {
    			tbl1.put(a1.charAt(i),1 );
    		}
    		else {
    			tbl1.put(a1.charAt(i), tbl1.get(a1.charAt(i))+1);
    		}
    	}
    	boolean check=true;
    	for(int i=0;i<b2.length();i++) {
    		if(tbl2.get(b2.charAt(i))==null) {
    			tbl2.put(b2.charAt(i),1 );
    		}
    		else {
    			tbl2.put(b2.charAt(i), tbl2.get(b2.charAt(i))+1);
    		}
    	}
    //	System.out.println(tbl2);
    	for(int i=0;i<a1.length();i++) {
    		if(tbl2.get(a1.charAt(i))!=null && tbl1.get(a1.charAt(i))==tbl2.get(b2.charAt(i))) {
    			check=true;
    		}
    		else {
    			check=false;
    			return check;
    		}
    	}
    //	System.out.println(tbl1);
    //	System.out.println(tbl2);
    	tbl1.clear();
    	tbl2.clear();
    	for(int i=0;i<a2.length();i++) {
    		if(tbl1.get(a2.charAt(i))==null) {
    			tbl1.put(a2.charAt(i),1 );
    		}
    		else {
    			tbl1.put(a2.charAt(i), tbl1.get(a2.charAt(i))+1);
    		}
    	}
    	for(int i=0;i<b1.length();i++) {
    		if(tbl2.get(b1.charAt(i))==null) {
    			tbl2.put(b1.charAt(i),1 );
    		}
    		else {
    			tbl2.put(b1.charAt(i), tbl2.get(b1.charAt(i))+1);
    		}
    	}
    	check=false;
    	for(int i=0;i<a2.length();i++) {
    		if(tbl2.get(a2.charAt(i))!=null && tbl1.get(a2.charAt(i))==tbl2.get(b1.charAt(i))) {
    			check=true;
    		}
    		else {
    			check=false;
    			return check;
    		}
    	}

    	return check;
    }

    static class Reader   // here reader class is defined.
    {
        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]; // line length
            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 * 10 + 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 void close() throws IOException
        {
            if (din == null)
                return;
            din.close();
        }
    }

}


import java.util.Scanner;

public class MainB {

	public void run() {
		Scanner sc = new Scanner(System.in);
		String a = sc.next();
		String b = sc.next();
		sc.close();
		if (a.length() % 2 == 1) {
			if (a.equals(b)) {
				System.out.println("YES");
			} else {
				System.out.println("NO");
			}
			return;
		}

		System.out.println(match(a, b) ? "YES" : "NO");
	}

	private boolean match(String s1, String s2) {
		if (s1.equals(s2))
			return true;
		if (s1.length() % 2 == 1) {
			return false;
		}
		int N = s1.length();
		String s1a = s1.substring(0, N / 2);
		String s1b = s1.substring(N / 2, N);
		String s2a = s2.substring(0, N / 2);
		String s2b = s2.substring(N / 2, N);
		boolean f1 = match(s1a, s2a);
		boolean f2 = match(s1b, s2b);
		if (f1 && f2) {
			return true;
		}

		boolean f3 = match(s1b, s2a);
		boolean f4 = match(s1a, s2b);
		if (f3 && f4) {
			return true;
		}

		return false;
	}

	public static void main(String[] args) {
		new MainB().run();
	}

}


import java.util.Scanner;

public class MainB {

	public void run() {
		Scanner sc = new Scanner(System.in);
		String a = sc.next();
		String b = sc.next();
		sc.close();
		if (a.length() % 2 == 1) {
			if (a.equals(b)) {
				System.out.println("YES");
			} else {
				System.out.println("NO");
			}
			return;
		}

		System.out.println(match(a, b) ? "YES" : "NO");
	}

	private boolean match(String s1, String s2) {
		int N = s1.length();
		if (s1.equals(s2))
			return true;
		if (N % 2 == 1) {
			return false;
		}
		String s1a = s1.substring(0, N / 2);
		String s1b = s1.substring(N / 2, N);
		String s2a = s2.substring(0, N / 2);
		String s2b = s2.substring(N / 2, N);
		if (match(s1a, s2a) && match(s1b, s2b)) {
			return true;
		}

		if (match(s1b, s2a) && match(s1a, s2b)) {
			return true;
		}

		return false;
	}

	public static void main(String[] args) {
		new MainB().run();
	}

}


import java.util.Scanner;

public class Main {

	public void solve() {
		Scanner scanner = new Scanner(System.in);
		String a = scanner.next();
		String b = scanner.next();
		scanner.close();

		if (equivalent(a, b)) {
			System.out.println("YES");
		} else {
			System.out.println("NO");
		}
	}

	private boolean equivalent(String a, String b) {
		int N = a.length();
		if (a.equals(b)) {
			return true;
		}
		if (N % 2 == 1) {
			return false;
		}

		int[] cnt = new int[26];
		for (int i = 0; i < N; i++) {
			cnt[a.charAt(i) - 'a']++;
		}
		for (int i = 0; i < N; i++) {
			cnt[b.charAt(i) - 'a']--;
		}
		for (int i = 0; i < 26; i++) {
			if (cnt[i] != 0) {
				return false;
			}
		}

		String a1 = a.substring(0, N / 2);
		String b1 = b.substring(0, N / 2);
		String a2 = a.substring(N / 2, N);
		String b2 = b.substring(N / 2, N);
		if (equivalent(a1, b2) && equivalent(a2, b1)) {
			return true;
		}

		if (equivalent(a1, b1) && equivalent(a2, b2)) {
			return true;
		}
		return false;

	}

	public static void main(String[] args) {
		new Main().solve();
	}
}


import java.util.Scanner;

public class MainB {

	void run() {
		Scanner sc = new Scanner(System.in);
		String a = sc.next();
		String b = sc.next();
		if (a.length() % 2 == 1) {
			if (a.equals(b)) {
				System.out.println("YES");
			} else {
				System.out.println("NO");
			}
			return;
		}

		System.out.println(match(a, b) ? "YES" : "NO");
	}

	boolean match(String s1, String s2) {
		if (s1.equals(s2))
			return true;
		if (s1.length() % 2 == 1) {
			return false;
		}
		int N = s1.length();
		String s1a = s1.substring(0, N / 2);
		String s1b = s1.substring(N / 2, N);
		String s2a = s2.substring(0, N / 2);
		String s2b = s2.substring(N / 2, N);
		boolean f1 = match(s1a, s2a);
		boolean f2 = match(s1b, s2b);
		boolean f3 = match(s1b, s2a);
		boolean f4 = match(s1a, s2b);
		if ((f1 && f2) || (f3 && f4)) {
			return true;
		}
		return false;
	}

	public static void main(String[] args) {
		new MainB().run();
	}

}


import java.util.Scanner;

public class Main {

	public void solve() {
		Scanner scanner = new Scanner(System.in);
		String a = scanner.next();
		String b = scanner.next();
		scanner.close();

		if (equivalent(a, b)) {
			System.out.println("YES");
		} else {
			System.out.println("NO");
		}
	}

	private boolean equivalent(String a, String b) {
		int N = a.length();
		if (a.equals(b)) {
			return true;
		}
		if (N % 2 == 1) {
			return false;
		}

		String a1 = a.substring(0, N / 2);
		String b1 = b.substring(0, N / 2);
		String a2 = a.substring(N / 2, N);
		String b2 = b.substring(N / 2, N);
		if (equivalent(a1, b2) && equivalent(a2, b1)) {
			return true;
		}

		if (equivalent(a1, b1) && equivalent(a2, b2)) {
			return true;
		}
		return false;

	}

	public static void main(String[] args) {
		new Main().solve();
	}
}


import java.util.Scanner;

public class MainB {

	void run() {
		Scanner sc = new Scanner(System.in);
		String a = sc.next();
		String b = sc.next();
		sc.close();
		if (a.length() % 2 == 1) {
			if (a.equals(b)) {
				System.out.println("YES");
			} else {
				System.out.println("NO");
			}
			return;
		}

		System.out.println(match(a, b) ? "YES" : "NO");
	}

	boolean match(String s1, String s2) {
		if (s1.equals(s2))
			return true;
		if (s1.length() % 2 == 1) {
			return false;
		}
		int N = s1.length();
		String s1a = s1.substring(0, N / 2);
		String s1b = s1.substring(N / 2, N);
		String s2a = s2.substring(0, N / 2);
		String s2b = s2.substring(N / 2, N);
		boolean f1 = match(s1a, s2a);
		boolean f2 = match(s1b, s2b);
		if (f1 && f2) {
			return true;
		}

		boolean f3 = match(s1b, s2a);
		boolean f4 = match(s1a, s2b);
		if (f3 && f4) {
			return true;
		}

		return false;
	}

	public static void main(String[] args) {
		new MainB().run();
	}

}


import java.util.Scanner;

public class MainB {

	void run() {
		Scanner sc = new Scanner(System.in);
		String a = sc.next();
		String b = sc.next();
		if (a.length() % 2 == 1) {
			if (a.equals(b)) {
				System.out.println("YES");
			} else {
				System.out.println("NO");
			}
			return;
		}

		System.out.println(match(a, b) ? "YES" : "NO");
	}

	boolean match(String s1, String s2) {
		if (s1.equals(s2))
			return true;

		if (s1.length() >= 2) {
			String s1a = s1.substring(0, s1.length() / 2);
			String s1b = s1.substring(s1.length() / 2, s1.length());
			String s2a = s2.substring(0, s2.length() / 2);
			String s2b = s2.substring(s2.length() / 2, s2.length());
			boolean f1 = match(s1a, s2a);
			boolean f2 = match(s1b, s2b);
			boolean f3 = match(s1b, s2a);
			boolean f4 = match(s1a, s2b);
			if ((f1 && f2) || (f3 && f4))
				return true;
			return false;
		} else {
			return false;
		}
	}

	public static void main(String[] args) {
		new MainB().run();
	}

}


import java.util.Scanner;

public class Main {

	public void solve() {
		Scanner scanner = new Scanner(System.in);
		String a = scanner.next();
		String b = scanner.next();
		scanner.close();

		if (equivalent(a, b)) {
			System.out.println("YES");
		} else {
			System.out.println("NO");
		}
	}

	private boolean equivalent(String a, String b) {
		int N = a.length();
		if (a.equals(b)) {
			return true;
		}
		if (N % 2 == 1) {
			return false;
		}

		String a1 = a.substring(0, N / 2);
		String b1 = b.substring(0, N / 2);
		String a2 = a.substring(N / 2, N);
		String b2 = b.substring(N / 2, N);
		if (equivalent(a1, b1) && equivalent(a2, b2)) {
			return true;
		}
		if (equivalent(a1, b2) && equivalent(a2, b1)) {
			return true;
		}
		return false;

	}

	public static void main(String[] args) {
		new Main().solve();
	}
}


import java.util.Scanner;

public class Main {

	public void solve() {
		Scanner scanner = new Scanner(System.in);
		String a = scanner.next();
		String b = scanner.next();
		scanner.close();

		if (equivalent(a, b)) {
			System.out.println("YES");
		} else {
			System.out.println("NO");
		}
	}

	private boolean equivalent(String a, String b) {
		int N = a.length();
		if (a.equals(b)) {
			return true;
		}
		if (N % 2 == 1) {
			return false;
		}

		String a1 = a.substring(0, N / 2);
		String b1 = b.substring(0, N / 2);
		String a2 = a.substring(N / 2, N);
		String b2 = b.substring(N / 2, N);
		if (equivalent(a1, b2) && equivalent(a2, b1)) {
			return true;
		}
		if (equivalent(a1, b1) && equivalent(a2, b2)) {
			return true;
		}
		return false;

	}

	public static void main(String[] args) {
		new Main().solve();
	}
}


import java.util.Arrays;
import java.util.Scanner;

public class Main {

	private int[] cnt = new int[26];

	public void solve() {
		Scanner scanner = new Scanner(System.in);
		String a = scanner.next();
		String b = scanner.next();
		scanner.close();

		if (equivalent(a, b)) {
			System.out.println("YES");
		} else {
			System.out.println("NO");
		}
	}

	private boolean equivalent(String a, String b) {
		int N = a.length();
		if (a.equals(b)) {
			return true;
		}
		if (N % 2 == 1) {
			return false;
		}

		Arrays.fill(cnt, 0);
		for (int i = 0; i < N; i++) {
			cnt[a.charAt(i) - 'a']++;
		}
		for (int i = 0; i < N; i++) {
			cnt[b.charAt(i) - 'a']--;
		}
		for (int i = 0; i < 26; i++) {
			if (cnt[i] != 0) {
				return false;
			}
		}

		String a1 = a.substring(0, N / 2);
		String b1 = b.substring(0, N / 2);
		String a2 = a.substring(N / 2, N);
		String b2 = b.substring(N / 2, N);

		if (equivalent(a1, b1) && equivalent(a2, b2)) {
			return true;
		}
		if (equivalent(a1, b2) && equivalent(a2, b1)) {
			return true;
		}
		return false;

	}

	public static void main(String[] args) {
		new Main().solve();
	}
}


import java.util.Scanner;

public class MainB {

	void run() {
		Scanner sc = new Scanner(System.in);
		String a = sc.next();
		String b = sc.next();
		if (a.length() % 2 == 1) {
			if (a.equals(b)) {
				System.out.println("YES");
			} else {
				System.out.println("NO");
			}
			return;
		}

		System.out.println(match(a, b) ? "YES" : "NO");
	}

	boolean match(String s1, String s2) {
		if (s1.equals(s2))
			return true;
		if (s1.length() % 2 == 1) {
			return false;
		}

		if (s1.length() >= 2) {
			int N = s1.length();
			String s1a = s1.substring(0, N / 2);
			String s1b = s1.substring(N / 2, N);
			String s2a = s2.substring(0, N / 2);
			String s2b = s2.substring(N / 2, N);
			boolean f1 = match(s1a, s2a);
			boolean f2 = match(s1b, s2b);
			boolean f3 = match(s1b, s2a);
			boolean f4 = match(s1a, s2b);
			if ((f1 && f2) || (f3 && f4)) {
				return true;
			}
			return false;
		} else {
			return false;
		}
	}

	public static void main(String[] args) {
		new MainB().run();
	}

}


import java.util.Scanner;

public class Main {

	public void solve() {
		Scanner scanner = new Scanner(System.in);
		String a = scanner.next();
		String b = scanner.next();
		scanner.close();

		if (equivalent(a, b)) {
			System.out.println("YES");
		} else {
			System.out.println("NO");
		}
	}

	private boolean equivalent(String a, String b) {
		int N = a.length();
		if (a.equals(b)) {
			return true;
		}
		if (N % 2 == 1) {
			return false;
		}

		String a1 = a.substring(0, N / 2);
		String b1 = b.substring(0, N / 2);
		String a2 = a.substring(N / 2, N);
		String b2 = b.substring(N / 2, N);
		if (equivalent(a1, b2) && equivalent(a2, b1)) {
			return true;
		}
		return false;

	}

	public static void main(String[] args) {
		new Main().solve();
	}
}


import java.util.Scanner;

public class MainB {

	void run() {
		Scanner sc = new Scanner(System.in);
		String a = sc.next();
		String b = sc.next();
		if (a.length() % 2 == 1) {
			if (a.equals(b)) {
				System.out.println("YES");
			} else {
				System.out.println("NO");
			}
			return;
		}

		System.out.println(match(a, b) ? "YES" : "NO");
	}

	boolean match(String s1, String s2) {
		if (s1.equals(s2))
			return true;

		if (s1.length() >= 2) {
			int N = s1.length();
			String s1a = s1.substring(0, N / 2);
			String s1b = s1.substring(N / 2, N);
			String s2a = s2.substring(0, N / 2);
			String s2b = s2.substring(N / 2, N);
			boolean f1 = match(s1a, s2a);
			boolean f2 = match(s1b, s2b);
			boolean f3 = match(s1b, s2a);
			boolean f4 = match(s1a, s2b);
			if ((f1 && f2) || (f3 && f4))
				return true;
			return false;
		} else {
			return false;
		}
	}

	public static void main(String[] args) {
		new MainB().run();
	}

}


import java.util.Scanner;

public class MainB {

	public void run() {
		Scanner sc = new Scanner(System.in);
		String a = sc.next();
		String b = sc.next();
		sc.close();
		if (a.length() % 2 == 1) {
			if (a.equals(b)) {
				System.out.println("YES");
			} else {
				System.out.println("NO");
			}
			return;
		}

		System.out.println(match(a, b) ? "YES" : "NO");
	}

	private boolean match(String s1, String s2) {
		if (s1.equals(s2))
			return true;
		if (s1.length() % 2 == 1) {
			return false;
		}
		int N = s1.length();
		String s1a = s1.substring(0, N / 2);
		String s1b = s1.substring(N / 2, N);
		String s2a = s2.substring(0, N / 2);
		String s2b = s2.substring(N / 2, N);
		if (match(s1a, s2a) && match(s1b, s2b)) {
			return true;
		}

		if (match(s1b, s2a) && match(s1a, s2b)) {
			return true;
		}

		return false;
	}

	public static void main(String[] args) {
		new MainB().run();
	}

}


import java.util.Scanner;

public class Main {

	public void solve() {
		Scanner scanner = new Scanner(System.in);
		String a = scanner.next();
		String b = scanner.next();
		scanner.close();

		if (equivalent(a, b)) {
			System.out.println("YES");
		} else {
			System.out.println("NO");
		}
	}

	private boolean equivalent(String a, String b) {
		int N = a.length();
		if (a.equals(b)) {
			return true;
		}
		if (N % 2 == 1) {
			return false;
		}

		String a1 = a.substring(0, N / 2);
		String b1 = b.substring(0, N / 2);
		String a2 = a.substring(N / 2, N);
		String b2 = b.substring(N / 2, N);

		boolean f1 = equivalent(a1, b2);
		boolean f2 = equivalent(a2, b1);

		if (f1 && f2) {
			return true;
		}
		if (equivalent(a1, b1) && equivalent(a2, b2)) {
			return true;
		}
		return false;

	}

	public static void main(String[] args) {
		new Main().solve();
	}
}


import java.util.Arrays;
import java.util.Scanner;

public class Main {

	private int[] cnt = new int[26];

	public void solve() {
		Scanner scanner = new Scanner(System.in);
		String a = scanner.next();
		String b = scanner.next();
		scanner.close();

		if (equivalent(a, b)) {
			System.out.println("YES");
		} else {
			System.out.println("NO");
		}
	}

	private boolean equivalent(String a, String b) {
		int N = a.length();
		if (a.equals(b)) {
			return true;
		}
		if (N % 2 == 1) {
			return false;
		}

		// ここでチェックする
		Arrays.fill(cnt, 0);
		for (int i = 0; i < N; i++) {
			cnt[a.charAt(i) - 'a']++;
		}
		for (int i = 0; i < N; i++) {
			cnt[b.charAt(i) - 'a']--;
		}
		for (int i = 0; i < 26; i++) {
			if (cnt[i] != 0) {
				return false;
			}
		}

		String a1 = a.substring(0, N / 2);
		String b1 = b.substring(0, N / 2);
		String a2 = a.substring(N / 2, N);
		String b2 = b.substring(N / 2, N);

		if (equivalent(a1, b1) && equivalent(a2, b2)) {
			return true;
		}
		if (equivalent(a1, b2) && equivalent(a2, b1)) {
			return true;
		}
		return false;

	}

	public static void main(String[] args) {
		new Main().solve();
	}
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class ProblemB2 {
    BufferedReader rd;

    ProblemB2() throws IOException {
        rd = new BufferedReader(new InputStreamReader(System.in));
        compute();
    }

    private void compute() throws IOException {
        String a = rd.readLine();
        String b = rd.readLine();
        out(eq(a,b)?"YES":"NO");
    }

    private boolean eq(String a, String b) {
        if(a.equals(b)) {
            return true;
        }
        int n = a.length();
        if(n%2==1) {
            return false;
        }
        String a1 = a.substring(0,n/2);
        String a2 = a.substring(n/2);
        String b1 = b.substring(0,n/2);
        String b2 = b.substring(n/2);
        if(a1.compareTo(a2) > 0) {
            String tmp = a1;
            a1 = a2;
            a2 = tmp;
        }
        if(b1.compareTo(b2) > 0) {
            String tmp = b1;
            b1 = b2;
            b2 = tmp;
        }
        return a.equals(b1+b2) || (eq(a1,b1) && (eq(a2,b2)));
    }

    private static void out(Object x) {
        System.out.println(x);
    }

    public static void main(String[] args) throws IOException {
        new ProblemB2();
    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class ProblemB2 {
    BufferedReader rd;

    ProblemB2() throws IOException {
        rd = new BufferedReader(new InputStreamReader(System.in));
        compute();
    }

    private void compute() throws IOException {
        String a = rd.readLine();
        String b = rd.readLine();
        out(eq(a,b)?"YES":"NO");
    }

    private boolean eq(String a, String b) {
        if(a.equals(b)) {
            return true;
        }
        int n = a.length();
        if(n%2==1) {
            return false;
        }
        String a1 = a.substring(0,n/2);
        String a2 = a.substring(n/2);
        String b1 = b.substring(0,n/2);
        String b2 = b.substring(n/2);
        if(a1.compareTo(a2) > 0) {
            String tmp = a1;
            a1 = a2;
            a2 = tmp;
        }
        if(b1.compareTo(b2) > 0) {
            String tmp = b1;
            b1 = b2;
            b2 = tmp;
        }
        return ((a1+a2).equals(b1+b2)) || (eq(a1,b1) && (eq(a2,b2)));
    }

    private static void out(Object x) {
        System.out.println(x);
    }

    public static void main(String[] args) throws IOException {
        new ProblemB2();
    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class ProblemB {
    BufferedReader rd;
    private char[] a;
    private char[] b;

    ProblemB() throws IOException {
        rd = new BufferedReader(new InputStreamReader(System.in));
        compute();
    }

    private void compute() throws IOException {
        a = rd.readLine().toCharArray();
        b = rd.readLine().toCharArray();
        out(eq(0, 0, a.length)?"YES":"NO");
    }

    private boolean eq(int aFrom, int bFrom, int len) {
        if(len%2==1) {
            for(int i=0;i<len;i++) {
                if(a[aFrom+i] != b[bFrom+i]) {
                    return false;
                }
            }
            return true;
        }
        boolean h1 = true;
        boolean h2 = true;
        boolean x1 = true;
        boolean x2 = true;
        int hlen = len/2;
        for(int i=0;i<hlen;i++) {
            if(a[aFrom+i] != b[bFrom+i]) {
                h1 = false;
                break;
            }
        }
        for(int i=0;i<hlen;i++) {
            if(a[aFrom+hlen+i] != b[bFrom+hlen+i]) {
                h2 = false;
                break;
            }
        }
        for(int i=0;i<hlen;i++) {
            if(a[aFrom+i] != b[bFrom+hlen+i]) {
                x1 = false;
                break;
            }
        }
        for(int i=0;i<hlen;i++) {
            if(a[aFrom+hlen+i] != b[bFrom+i]) {
                x2 = false;
                break;
            }
        }
        if(h1 && h2) {
            return true;
        }
        if(x1 && x2) {
            return true;
        }
        if(h1) {
            if(eq(aFrom+hlen, bFrom+hlen, hlen)) {
                return true;
            }
        }
        if(h2) {
            if(eq(aFrom, bFrom, hlen)) {
                return true;
            }
        }
        if(x1) {
            if(eq(aFrom+hlen, bFrom, hlen)) {
                return true;
            }
        }
        if(x2) {
            if(eq(aFrom, bFrom+hlen, hlen)) {
                return true;
            }
        }
        return (eq(aFrom, bFrom, hlen) && eq(aFrom+hlen, bFrom+hlen, hlen)) || (eq(aFrom+hlen, bFrom, hlen) && eq(aFrom, bFrom+hlen, hlen));
    }

    private static void out(Object x) {
        System.out.println(x);
    }

    public static void main(String[] args) throws IOException {
        new ProblemB();
    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class ProblemB2 {
    BufferedReader rd;

    ProblemB2() throws IOException {
        rd = new BufferedReader(new InputStreamReader(System.in));
        compute();
    }

    private void compute() throws IOException {
        String a = rd.readLine();
        String b = rd.readLine();
        out(eq(a,b)?"YES":"NO");
    }

    private boolean eq(String a, String b) {
        return smallest(a).equals(smallest(b));
    }

    public String smallest(String s) {
        if (s.length() % 2 == 1) {
            return s;
        }
        String s1 = smallest(s.substring(0, s.length()/2));
        String s2 = smallest(s.substring(s.length()/2));
        if (s1.compareTo(s2) < 0) {
            return s1 + s2;
        } else {
            return s2 + s1;
        }
    }

    private static void out(Object x) {
        System.out.println(x);
    }

    public static void main(String[] args) throws IOException {
        new ProblemB2();
    }
}


//https://codeforces.com/problemset/problem/559/B

import java.util.Scanner;

public class Main {
	//static long mod = 5000001;

	public static void main(String[] args) {

		Scanner nik = new Scanner(System.in);

		String s1 = nik.next();
		String s2 = nik.next();
		boolean b = false;

		//Method 1;
//		String res1=get(s1);
//		String res2=get(s2);
//		System.out.println(res1.compareTo(res2) == 0 ? "YES" : "NO");

		//Mathod2
		if(check(s1,s2))
			System.out.println("YES");
		else
			System.out.println("NO");
	}
	//Method2
	public static boolean check(String a,String b) {
		int n1=a.length();
		int n2=b.length();

		if(a.equals(b))
			return true;
		if(n1%2 !=0)
			return false;

		String a1=a.substring(0,n1/2);
		String a2=a.substring(n1/2,n1);
		String b1=b.substring(0,n2/2);
		String b2=b.substring(n2/2,n2);

		return (check(a1, b1) && check(a2, b2)) || (check(a1, b2) && check(a2, b1));

	}

	//Method1
//	private static String get(String s1) {
//		int n = s1.length();
//		if (s1.length() % 2 != 0) {
//			return s1;
//		}
//		String temp1 = get(s1.substring(0, n >> 1));
//		String temp2 = get(s1.substring(n >> 1, s1.length()));
//
//		if (temp1.compareTo(temp2) < 0) {
//			return temp1 + temp2;
//		}
//		return temp2 + temp1;
//	}

}


//https://codeforces.com/problemset/problem/559/B

import java.util.Scanner;

public class Main2103 {
	//static long mod = 5000001;

	public static void main(String[] args) {

		Scanner nik = new Scanner(System.in);

		String s1 = nik.next();
		String s2 = nik.next();
		boolean b = false;

		String res1=get(s1);
		String res2=get(s2);
		System.out.println(res1.compareTo(res2) == 0 ? "YES" : "NO");

	}

	private static String get(String s1) {
		int n = s1.length();
		if (s1.length() % 2 != 0) {
			return s1;
		}
		String temp1 = get(s1.substring(0, n >> 1));
		String temp2 = get(s1.substring(n >> 1, s1.length()));

		if (temp1.compareTo(temp2) < 0) {
			return temp1 + temp2;
		}
		return temp2 + temp1;
	}

}


//https://codeforces.com/problemset/problem/559/B

import java.util.Scanner;

public class Main2103 {
	//static long mod = 5000001;

	public static void main(String[] args) {

		Scanner nik = new Scanner(System.in);

		String s1 = nik.next();
		String s2 = nik.next();
		boolean b = false;

		//Method 1;
//		String res1=get(s1);
//		String res2=get(s2);
//		System.out.println(res1.compareTo(res2) == 0 ? "YES" : "NO");

		//Mathod2
		if(check(s1,s2))
			System.out.println("YES");
		else
			System.out.println("NO");
	}
	//Method2
	public static boolean check(String a,String b) {
		int n1=a.length();
		int n2=b.length();

		if(a.equals(b))
			return true;
		if(n1%2 !=0)
			return false;

		String a1=a.substring(0,n1>>1);
		String a2=a.substring(n1>>1,n1);
		String b1=b.substring(0,n2>>1);
		String b2=b.substring(n2>>1,n2);

		return ((check(a1, b2) && check(a2, b1) || check(a1, b1) && check(a2, b2)));

	}

	//Method1
//	private static String get(String s1) {
//		int n = s1.length();
//		if (s1.length() % 2 != 0) {
//			return s1;
//		}
//		String temp1 = get(s1.substring(0, n >> 1));
//		String temp2 = get(s1.substring(n >> 1, s1.length()));
//
//		if (temp1.compareTo(temp2) < 0) {
//			return temp1 + temp2;
//		}
//		return temp2 + temp1;
//	}

}


//https://codeforces.com/problemset/problem/559/B

import java.util.Scanner;

public class Main2103 {
	//static long mod = 5000001;

	public static void main(String[] args) {

		Scanner nik = new Scanner(System.in);

		String s1 = nik.next();
		String s2 = nik.next();
		boolean b = false;

		//Method 1;
//		String res1=get(s1);
//		String res2=get(s2);
//		System.out.println(res1.compareTo(res2) == 0 ? "YES" : "NO");

		//Mathod2
		if(check(s1,s2))
			System.out.println("YES");
		else
			System.out.println("NO");
	}
	//Method2
	public static boolean check(String a,String b) {
		int n1=a.length();
		int n2=b.length();

		if(a.equals(b))
			return true;
		if(n1%2 !=0)
			return false;

		String a1=a.substring(0,n1/2);
		String a2=a.substring(n1/2,n1);
		String b1=b.substring(0,n2/2);
		String b2=b.substring(n2/2,n2);

		return ((check(a1, b2) && check(a2, b1) || check(a1, b1) && check(a2, b2)));

	}

	//Method1
//	private static String get(String s1) {
//		int n = s1.length();
//		if (s1.length() % 2 != 0) {
//			return s1;
//		}
//		String temp1 = get(s1.substring(0, n >> 1));
//		String temp2 = get(s1.substring(n >> 1, s1.length()));
//
//		if (temp1.compareTo(temp2) < 0) {
//			return temp1 + temp2;
//		}
//		return temp2 + temp1;
//	}

}


import java.io.*;
import java.util.*;

public class problema1 {

	private static MyScanner sc = new MyScanner();

	public static void main(String[] args) {
		problema1 cadenasequivalentes = new problema1();
		cadenasequivalentes.Empezar();
	}

	public void Empezar(){
		out = new PrintWriter(new BufferedOutputStream(System.out));
		String a = leerCadena();
		String b = leerCadena();
		if(equivalencia(smol(a), smol(b))){
			out.print("YES");
		}else{
			out.print("NO");
		}
		out.close();
	}

	public static String leerCadena(){
		String cadena = sc.next();
		while(cadena.length()>200000){
			cadena = sc.next();
		}
		return cadena;
	}

	public static boolean equivalencia(String a, String b){
		if(a.equals(b)){
			return true;
		}else{
			return false;
		}
	}

	public static String smol(String s){
		if(s.length()%2 == 1){
			return s;
		}
		String a = smol(s.substring(0, s.length()/2));
		String b = smol(s.substring(s.length()/2));
		if(a.compareTo(b)<=0){
			return a + b;
		}else{
			return b + a;
		}
	}

	public static PrintWriter out;

	public static class MyScanner {
		BufferedReader br;
		StringTokenizer st;

		public MyScanner() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String next() {
			while (st == null || !st.hasMoreElements()) {
				try {
					st = new StringTokenizer(br.readLine());
				}catch (IOException e) {
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

		String nextLine(){
			String str = "";
			try {
				str = br.readLine();
			}catch (IOException e) {
				e.printStackTrace();
			}
			return str;
		}
	}
}


import java.io.*;
import java.util.*;

public class problema1 {

	private static MyScanner sc = new MyScanner();

	public static void main(String[] args) {
		problema1 cadenasequivalentes = new problema1();
		cadenasequivalentes.Empezar();
	}

	public void Empezar(){
		String a = leerCadena();
		String b = leerCadena();
		if(equivalencia(a, b, a.length())){
			System.out.print("YES");
		}else{
			System.out.print("NO");
		}
	}

	public static String leerCadena(){
		String cadena = sc.next();
		while(cadena.length()>200000){
			cadena = sc.next();
		}
		return cadena;
	}

	public boolean equivalencia(String a, String b, int n){
		if(a.equals(b)){
			return true;
		}else if(n>1){
			if((equivalencia(a.substring(0, n/2), b.substring(0, n/2), n/2) && equivalencia(a.substring(n/2), b.substring(n/2), n/2)) || (equivalencia(a.substring(0, n/2), b.substring(n/2), n/2) && equivalencia(a.substring(n/2), b.substring(0, n/2), n/2))){
				return true;
			}
		}
		return false;
	}

	public static class MyScanner {
		BufferedReader br;
		StringTokenizer st;

		public MyScanner() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String next() {
			while (st == null || !st.hasMoreElements()) {
				try {
					st = new StringTokenizer(br.readLine());
				}catch (IOException e) {
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

		String nextLine(){
			String str = "";
			try {
				str = br.readLine();
			}catch (IOException e) {
				e.printStackTrace();
			}
			return str;
		}
	}
}


import java.util.*;

public class problema1 {

	private static Scanner sc = new Scanner(System.in);

	public static void main(String[] args) {
		problema1 cadenasequivalentes = new problema1();
		cadenasequivalentes.Empezar();
	}

	public void Empezar(){
		String a = leerCadena();
		String b = leerCadena();
		if(equivalencia(a, b, a.length())){
			System.out.print("YES");
		}else{
			System.out.print("NO");
		}
	}

	public static String leerCadena(){
		String cadena = sc.next();
		while(cadena.length()>200000){
			cadena = sc.next();
		}
		return cadena;
	}

	public static boolean equivalencia(String a, String b, int n){
		if(a.equals(b)){
			return true;
		}else if(n>1 && n%2!=1){
			if((equivalencia(a.substring(0, n/2), b.substring(0, n/2), n/2) && equivalencia(a.substring(n/2), b.substring(n/2), n/2)) || (equivalencia(a.substring(0, n/2), b.substring(n/2), n/2) && equivalencia(a.substring(n/2), b.substring(0, n/2), n/2))){
				return true;
			}
		}
		return false;
	}
}


import java.io.*;
import java.util.*;

public class problema1 {

	private static MyScanner sc = new MyScanner();

	public static void main(String[] args) {
		problema1 cadenasequivalentes = new problema1();
		cadenasequivalentes.Empezar();
	}

	public void Empezar(){
		out = new PrintWriter(new BufferedOutputStream(System.out));
		String a = leerCadena();
		String b = leerCadena();
		if(equivalencia(smol(a), smol(b))){
			out.print("YES");
		}else{
			out.print("NO");
		}
		out.close();
	}

	public static String leerCadena(){
		String cadena = sc.next();
		while(cadena.length()>200000){
			cadena = sc.next();
		}
		return cadena;
	}

	public static boolean equivalencia(String a, String b){
		if(a.equals(b)){
			return true;
		}else{
			return false;
		}
	}

	public static String smol(String s){
		if(s.length()%2 == 1){
			return s;
		}
		String a = smol(s.substring(0, s.length()/2));
		String b = smol(s.substring(s.length()/2));
		if(a.compareTo(b)==-1){
			return a + b;
		}else{
			return b + a;
		}
	}

	public static PrintWriter out;

	public static class MyScanner {
		BufferedReader br;
		StringTokenizer st;

		public MyScanner() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String next() {
			while (st == null || !st.hasMoreElements()) {
				try {
					st = new StringTokenizer(br.readLine());
				}catch (IOException e) {
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

		String nextLine(){
			String str = "";
			try {
				str = br.readLine();
			}catch (IOException e) {
				e.printStackTrace();
			}
			return str;
		}
	}
}


import java.io.*;
import java.util.*;

public class problema1 {

	private static MyScanner sc = new MyScanner();

	public static void main(String[] args) {
		problema1 cadenasequivalentes = new problema1();
		cadenasequivalentes.Empezar();
	}

	public void Empezar(){
		String a = leerCadena();
		String b = leerCadena();
		if(equivalencia(a, b, a.length())){
			System.out.print("YES");
		}else{
			System.out.print("NO");
		}
	}

	public static String leerCadena(){
		String cadena = sc.next();
		while(cadena.length()>200000){
			cadena = sc.next();
		}
		return cadena;
	}

	public boolean equivalencia(String a, String b, int n){
		if(a.equals(b)){
			return true;
		}else if(n>1 && n%2!=1){
			if((equivalencia(a.substring(0, n/2), b.substring(0, n/2), n/2) && equivalencia(a.substring(n/2), b.substring(n/2), n/2)) || (equivalencia(a.substring(0, n/2), b.substring(n/2), n/2) && equivalencia(a.substring(n/2), b.substring(0, n/2), n/2))){
				return true;
			}
		}
		return false;
	}

	public static class MyScanner {
		BufferedReader br;
		StringTokenizer st;

		public MyScanner() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String next() {
			while (st == null || !st.hasMoreElements()) {
				try {
					st = new StringTokenizer(br.readLine());
				}catch (IOException e) {
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

		String nextLine(){
			String str = "";
			try {
				str = br.readLine();
			}catch (IOException e) {
				e.printStackTrace();
			}
			return str;
		}
	}
}


import java.io.*;
import java.util.*;

public class problema1 {

	private static MyScanner sc = new MyScanner();

	public static void main(String[] args) {
		problema1 cadenasequivalentes = new problema1();
		cadenasequivalentes.Empezar();
	}

	public void Empezar(){
		String a = leerCadena();
		String b = leerCadena();
		if(equivalencia(a, b, a.length())){
			System.out.print("YES");
		}else{
			System.out.print("NO");
		}
	}

	public static String leerCadena(){
		String cadena = sc.next();
		while(cadena.length()>200000){
			cadena = sc.next();
		}
		return cadena;
	}

	public boolean equivalencia(String a, String b, int n){
		if(a.equals(b)){
			return true;
		}else if(n>1){
			if((equivalencia(a.substring(0, n/2), b.substring(0, n/2), n/2) && equivalencia(a.substring(n/2), b.substring(n/2), n/2)) || (equivalencia(a.substring(0, n/2), b.substring(n/2), n/2) && equivalencia(a.substring(n/2), b.substring(0, n/2), n/2))){
				return true;
			}else{
				return false;
			}
		}else{
			return false;
		}
	}

	public static class MyScanner {
		BufferedReader br;
		StringTokenizer st;

		public MyScanner() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String next() {
			while (st == null || !st.hasMoreElements()) {
				try {
					st = new StringTokenizer(br.readLine());
				}catch (IOException e) {
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

		String nextLine(){
			String str = "";
			try {
				str = br.readLine();
			}catch (IOException e) {
				e.printStackTrace();
			}
			return str;
		}
	}
}


import java.io.*;
import java.util.*;

public class problema1 {

	private static MyScanner sc = new MyScanner();

	public static void main(String[] args) {
		problema1 cadenasequivalentes = new problema1();
		cadenasequivalentes.Empezar();
	}

	public void Empezar(){
		String a = leerCadena();
		String b = leerCadena();
		if(equivalencia(a, b, a.length())){
			System.out.print("YES");
		}else{
			System.out.print("NO");
		}
	}

	public static String leerCadena(){
		String cadena = sc.next();
		while(cadena.length()>200000){
			cadena = sc.next();
		}
		return cadena;
	}

	public static boolean equivalencia(String a, String b, int n){
		if(a.equals(b)){
			return true;
		}else if(n>1 && n%2!=1){
			if(equivalencia(a.substring(0, n/2), b.substring(0, n/2), n/2) && equivalencia(a.substring(n/2), b.substring(n/2), n/2)){
				return true;
			}
			if(equivalencia(a.substring(0, n/2), b.substring(n/2), n/2) && equivalencia(a.substring(n/2), b.substring(0, n/2), n/2)){
				return true;
			}
		}
		return false;
	}

	public static class MyScanner {
		BufferedReader br;
		StringTokenizer st;

		public MyScanner() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String next() {
			while (st == null || !st.hasMoreElements()) {
				try {
					st = new StringTokenizer(br.readLine());
				}catch (IOException e) {
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

		String nextLine(){
			String str = "";
			try {
				str = br.readLine();
			}catch (IOException e) {
				e.printStackTrace();
			}
			return str;
		}
	}
}


import java.io.*;
import java.util.*;

public class problema1 {

	public static void main(String[] args) {
		problema1 cadenasequivalentes = new problema1();
		cadenasequivalentes.Empezar();
	}

	public void Empezar(){
		String a = leerCadena();
		String b = leerCadena();
		if(equivalencia(a, b, a.length())){
			System.out.print("YES");
		}else{
			System.out.print("NO");
		}
	}

	public static String leerCadena(){
		MyScanner sc = new MyScanner();
		String cadena = sc.next();
		while(cadena.length()>200000){
			cadena = sc.next();
		}
		return cadena;
	}

	public boolean equivalencia(String a, String b, int n){
		if(a.equals(b)){
			return true;
		}else if(n>1){
			if((equivalencia(a.substring(0, n/2), b.substring(0, n/2), n/2) && equivalencia(a.substring(n/2), b.substring(n/2), n/2)) || (equivalencia(a.substring(0, n/2), b.substring(n/2), n/2) && equivalencia(a.substring(n/2), b.substring(0, n/2), n/2))){
				return true;
			}else{
				return false;
			}
		}else{
			return false;
		}
	}

	public static class MyScanner {
		BufferedReader br;
		StringTokenizer st;

		public MyScanner() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String next() {
			while (st == null || !st.hasMoreElements()) {
				try {
					st = new StringTokenizer(br.readLine());
				}catch (IOException e) {
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

		String nextLine(){
			String str = "";
			try {
				str = br.readLine();
			}catch (IOException e) {
				e.printStackTrace();
			}
			return str;
		}
	}
}


import java.io.*;
import java.util.*;

public class problema1 {

	private static MyScanner sc = new MyScanner();

	public static void main(String[] args) {
		String a = leerCadena();
		String b = leerCadena();
		if(equivalencia(a, b, a.length())){
			System.out.print("YES");
		}else{
			System.out.print("NO");
		}
	}

	public static String leerCadena(){
		String cadena = sc.next();
		while(cadena.length()>200000){
			cadena = sc.next();
		}
		return cadena;
	}

	public static boolean equivalencia(String a, String b, int n){
		if(a.equals(b)){
			return true;
		}else if(n>1 && n%2!=1){
			if((equivalencia(a.substring(0, n/2), b.substring(0, n/2), n/2) && equivalencia(a.substring(n/2), b.substring(n/2), n/2)) || (equivalencia(a.substring(0, n/2), b.substring(n/2), n/2) && equivalencia(a.substring(n/2), b.substring(0, n/2), n/2))){
				return true;
			}
		}
		return false;
	}

	public static class MyScanner {
		BufferedReader br;
		StringTokenizer st;

		public MyScanner() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String next() {
			while (st == null || !st.hasMoreElements()) {
				try {
					st = new StringTokenizer(br.readLine());
				}catch (IOException e) {
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

		String nextLine(){
			String str = "";
			try {
				str = br.readLine();
			}catch (IOException e) {
				e.printStackTrace();
			}
			return str;
		}
	}
}


import java.io.*;
import java.util.*;

public class problema1 {

	private static MyScanner sc = new MyScanner();

	public static void main(String[] args) {
		problema1 cadenasequivalentes = new problema1();
		cadenasequivalentes.Empezar();
	}

	public void Empezar(){
		out = new PrintWriter(new BufferedOutputStream(System.out));
		String a = leerCadena();
		String b = leerCadena();
		if(equivalencia(a, b, a.length())){
			out.print("YES");
		}else{
			out.print("NO");
		}
		out.close();
	}

	public static String leerCadena(){
		String cadena = sc.next();
		while(cadena.length()>200000){
			cadena = sc.next();
		}
		return cadena;
	}

	public static boolean equivalencia(String a, String b, int n){
		if(a.equals(b)){
			return true;
		}else if(n>1 && n%2!=1){
			if((equivalencia(a.substring(0, n/2), b.substring(0, n/2), n/2) && equivalencia(a.substring(n/2), b.substring(n/2), n/2)) || (equivalencia(a.substring(0, n/2), b.substring(n/2), n/2) && equivalencia(a.substring(n/2), b.substring(0, n/2), n/2))){
				return true;
			}
		}
		return false;
	}

	public static PrintWriter out;

	public static class MyScanner {
		BufferedReader br;
		StringTokenizer st;

		public MyScanner() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String next() {
			while (st == null || !st.hasMoreElements()) {
				try {
					st = new StringTokenizer(br.readLine());
				}catch (IOException e) {
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

		String nextLine(){
			String str = "";
			try {
				str = br.readLine();
			}catch (IOException e) {
				e.printStackTrace();
			}
			return str;
		}
	}
}


import java.util.*;

public class problema1 {

	public static void main(String[] args) {
		problema1 cadenasequivalentes = new problema1();
		cadenasequivalentes.Empezar();
	}

	public void Empezar(){
		String a = leerCadena();
		String b = leerCadena();
		if(equivalencia(a, b, a.length())){
			System.out.print("YES");
		}else{
			System.out.print("NO");
		}
	}

	public static String leerCadena(){
		Scanner sc = new Scanner(System.in);
		String cadena = sc.next();
		while(cadena.length()>200000){
			cadena = sc.next();
		}
		return cadena;
	}

	public boolean equivalencia(String a, String b, int n){
		if(a.equals(b)){
			return true;
		}else if(n>1){
			if((equivalencia(a.substring(0, n/2), b.substring(0, n/2), n/2) && equivalencia(a.substring(n/2), b.substring(n/2), n/2)) || (equivalencia(a.substring(0, n/2), b.substring(n/2), n/2) && equivalencia(a.substring(n/2), b.substring(0, n/2), n/2))){
				return true;
			}else{
				return false;
			}
		}else{
			return false;
		}
	}

}


import java.util.Scanner;

/**
 * Created by Пользователь on 07.08.2015.
 */
public class Codeforces559B {
    private static String string1;
    private static String string2;

    public static boolean isEqual(int a, int b, int c, int d)
    {
        if (b - a == 0) {
            //System.out.println("CASE1 " + a + " " + b + " " + c + " " + d);
            return true;
        }

        if (b - a == 1) {
            //System.out.println("CASE2 " + a + " " + b + " " + c + " " + d);
            return string1.charAt(a)  == string2.charAt(c);
        }

        if ((b - a) % 2 == 0) {
            //System.out.println("CASE3 " + a + " " + b + " " + c + " " + d);
            int middle1 = (b - a) / 2 + a;
            int middle2 = (d - c) / 2 + c;

            return (isEqual(a, middle1, c, middle2) && isEqual(middle1, b, middle2, d)) || (isEqual(a, middle1, middle2, d) && isEqual(middle1, b, c, middle2));
        }

        //System.out.println("CASE4 " + a + " " + b + " " + c + " " + d);

        for (int i = a, j = c; i < b; ++i, ++j)
            if (string1.charAt(i) != string2.charAt(j))
                return false;

        return true;
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        string1 = sc.next();
        string2 = sc.next();

        if (isEqual(0, string1.length(), 0, string2.length()))
            System.out.println("YES");
        else
            System.out.println("NO");
    }

}


import java.util.Scanner;

/**
 * Created by Пользователь on 07.08.2015.
 */
public class Codeforces559B {
    private static String string1;
    private static String string2;

    public static boolean isEqual(int a, int b, int c, int d)
    {
        /*
        if (b - a == 0) {
            //System.out.println("CASE1 " + a + " " + b + " " + c + " " + d);
            return true;
        }*/

        if (b - a == 1) {
            //System.out.println("CASE2 " + a + " " + b + " " + c + " " + d);
            return string1.charAt(a)  == string2.charAt(c);
        }

        boolean f = true;

        for (int i = a, j = c; i < b; ++i, ++j)
            if (string1.charAt(i) != string2.charAt(j))
            {
                f = false;
                break;
            }

        if (f)
            return true;

        if ((b - a) % 2 == 0) {
            //System.out.println("CASE3 " + a + " " + b + " " + c + " " + d);
            int middle1 = (b - a) / 2 + a;
            int middle2 = (d - c) / 2 + c;

            return (isEqual(a, middle1, c, middle2) && isEqual(middle1, b, middle2, d)) || (isEqual(a, middle1, middle2, d) && isEqual(middle1, b, c, middle2));
        }

        //System.out.println("CASE4 " + a + " " + b + " " + c + " " + d);

        /*
        for (int i = a, j = c; i < b; ++i, ++j)
            if (string1.charAt(i) != string2.charAt(j))
                return false;
                */

        return false;
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        string1 = sc.next();
        string2 = sc.next();

        if (isEqual(0, string1.length(), 0, string2.length()))
            System.out.println("YES");
        else
            System.out.println("NO");
    }

}


import java.util.Scanner;

/**
 * Created by Пользователь on 07.08.2015.
 */
public class Codeforces599B2 {

    public static String sort(String s)
    {
        if (s.length() % 2 > 0)
            return s;

        int middle = s.length() / 2;

        String s1 = sort(s.substring(0, middle));
        String s2 = sort(s.substring(middle));

        if (s1.compareTo(s2) > 0)
            return s1 + s2;
        else
            return s2 + s1;

    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        String string1 = sc.next();
        String string2 = sc.next();

        if (sort(string1).equals(sort(string2)))
            System.out.println("YES");
        else
            System.out.println("NO");
    }
}


//package mergeCSVfiles;

// Working program with FastReader
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;
import java.util.StringTokenizer;

public class Main {
    /*This class is taken from geeksforgeeks.org*/
    static class FastReader {

        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
            }
            return str;
        }
    }

    public static boolean is_eq(String a, String b){
        if(a.length()%2 == 1){
            return a.compareTo(b) == 0;
        }

        int mid = a.length()/2;
        String a1 = a.substring(0, mid);
        String a2 = a.substring(mid);
        String b1 = b.substring(0, mid);
        String b2 = b.substring(mid);

        if(is_eq(a1, b1) && is_eq(a2, b2)){
            return true;
        }
        if(is_eq(a1, b2) && is_eq(a2, b1)){
            return true;
        }

        return false;
    }

    public static void main(String[] args) throws Exception {
        FastReader in = new FastReader();

        String a, b;
        a = in.next();
        b = in.next();

        String result;
        result = (is_eq(a,b) ? "YES": "NO");

        System.out.println(result);

    }

}


//package mergeCSVfiles;

// Working program with FastReader
import java.io.BufferedReader;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.Scanner;
import java.util.StringTokenizer;
import java.util.TreeSet;

public class Main {

    public static boolean is_eq(String a, String b){
        if(a.length() != b.length())
            return false;
        if(a.length() <= 1){
            return a.compareTo(b) == 0;
        }
        int mid = a.length()/2;

        String a1 = a.substring(0, mid);
        String a2 = a.substring(mid);
        String b1 = b.substring(0, mid);
        String b2 = b.substring(mid);

        if(is_eq(a1, b1) && is_eq(a2, b2))
            return true;
        if(is_eq(a1, b2) && is_eq(a2, b1))
            return true;

        return false;
    }

    public static void main(String[] args) throws Exception {
        Scanner in = new Scanner(System.in);

        String a, b;
        a = in.next();
        b = in.next();

        String result;
        result = (is_eq(a,b) ? "YES": "NO");

        System.out.println(result);

    }

}


//package mergeCSVfiles;

// Working program with FastReader
import java.util.Scanner;

public class Main {

    public static boolean is_eq(String a, String b){
        if(a.length()%2 == 1){
            return a.compareTo(b) == 0;
        }

        int mid = a.length()/2;
        String a1 = a.substring(0, mid);
        String a2 = a.substring(mid);
        String b1 = b.substring(0, mid);
        String b2 = b.substring(mid);

        if(is_eq(a1, b1) && is_eq(a2, b2)){
            return true;
        }
        if(is_eq(a1, b2) && is_eq(a2, b1)){
            return true;
        }

        return false;
    }

    public static void main(String[] args) throws Exception {
        Scanner in = new Scanner(System.in);

        String a, b;
        a = in.next();
        b = in.next();

        String result;
        result = (is_eq(a,b) ? "YES": "NO");

        System.out.println(result);

    }

}


//package mergeCSVfiles;

// Working program with FastReader
import java.io.BufferedReader;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.Scanner;
import java.util.StringTokenizer;
import java.util.TreeSet;

public class Main {

    public static boolean is_eq(String a, String b){
        if(a.length() <= 1){
            return a.compareTo(b) == 0;
        }
        int mid = a.length()/2;

        String a1 = a.substring(0, mid);
        String a2 = a.substring(mid);
        String b1 = b.substring(0, mid);
        String b2 = b.substring(mid);

        if(is_eq(a1, b1) && is_eq(a2, b2))
            return true;
        if(is_eq(a1, b2) && is_eq(a2, b1))
            return true;

        mid = (a.length()+1)/2;
        a1 = a.substring(0, mid);
        a2 = a.substring(mid);
        b1 = b.substring(0, mid);
        b2 = b.substring(mid);

        if(is_eq(a1, b1) && is_eq(a2, b2))
            return true;
        if(is_eq(a1, b2) && is_eq(a2, b1))
            return true;
        return false;
    }

    public static void main(String[] args) throws Exception {
        Scanner in = new Scanner(System.in);

        String a, b;
        a = in.next();
        b = in.next();

        String result;
        result = (is_eq(a,b) ? "YES": "NO");

        System.out.println(result);

    }

}


//package mergeCSVfiles;

// Working program with FastReader
import java.io.BufferedReader;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.Scanner;
import java.util.StringTokenizer;
import java.util.TreeSet;

public class Main {

    public static boolean is_eq(String a, String b){
        if(a.length() <= 1){
            return a.compareTo(b) == 0;
        }
        int mid = a.length()/2;

        String a1 = a.substring(0, mid);
        String a2 = a.substring(mid);
        String b1 = b.substring(0, mid);
        String b2 = b.substring(mid);

        if(is_eq(a1, b1) && is_eq(a2, b2))
            return true;
        if(is_eq(a1, b2) && is_eq(a2, b1))
            return true;
        return false;
    }

    public static void main(String[] args) throws Exception {
        Scanner in = new Scanner(System.in);

        String a, b;
        a = in.next();
        b = in.next();

        String result;
        result = (is_eq(a,b) ? "YES": "NO");

        System.out.println(result);

    }

}


//package mergeCSVfiles;

// Working program with FastReader
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;
import java.util.StringTokenizer;

public class Main {
    /*This class is taken from geeksforgeeks.org*/
    static class FastReader {

        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
            }
            return str;
        }
    }

    public static boolean is_eq(char[] a, char[] b, int ai, int aj, int bi, int bj){
        int n = aj - ai;
        if(n%2 == 1){
            for(int k = 0; k < n; k++){
                if(a[ai + k] != b[bi + k])
                    return false;
            }
            return true;
        }

        int mid = n/2;

        if(is_eq(a, b, ai, ai + mid, bi, bi + mid) && is_eq(a, b, ai + mid, aj, bi + mid, bj)){
            return true;
        }
        else if(is_eq(a, b, ai, ai + mid, bi + mid, bj) && is_eq(a, b, ai + mid, aj, bi, bi + mid)){
            return true;
        }
        return false;
    }

    public static void main(String[] args) throws Exception {
        FastReader in = new FastReader();

        String a, b;
        a = in.next();
        b = in.next();

        char[] aa = a.toCharArray();
        char[] bb = b.toCharArray();

        String result;
        result = (is_eq(aa,bb, 0, aa.length, 0, bb.length) ? "YES": "NO");

        System.out.println(result);

    }

}


//package mergeCSVfiles;

// Working program with FastReader
import java.io.BufferedReader;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.Scanner;
import java.util.StringTokenizer;
import java.util.TreeSet;

public class Main {

    public static boolean is_eq(String a, String b){

        if(a.length() <= 1){
            return a.compareTo(b) == 0;
        }

        int mid = a.length()/2;
        String a1 = a.substring(0, mid);
        String a2 = a.substring(mid);
        String b1 = b.substring(0, mid);
        String b2 = b.substring(mid);

        int result = 0;
        if(is_eq(a1, b1) && is_eq(a2, b2)){
            result += 1;
        }
        if(is_eq(a1, b2) && is_eq(a2, b1)){
            result += 1;
        }
        return result == 1;
    }

    public static void main(String[] args) throws Exception {
        Scanner in = new Scanner(System.in);

        String a, b;
        a = in.next();
        b = in.next();

        String result;
        result = (is_eq(a,b) ? "YES": "NO");

        System.out.println(result);

    }

}


//package mergeCSVfiles;

// Working program with FastReader
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;
import java.util.StringTokenizer;

public class Main {
    /*This class is taken from geeksforgeeks.org*/
    static class FastReader {

        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
            }
            return str;
        }
    }

    public static String smallest(String a){
        if(a.length()%2 == 1){
            return a;
        }
        int mid = a.length()/2;
        String a1 = smallest(a.substring(0, mid));
        String a2 = smallest(a.substring(mid));

        if(a1.compareTo(a2) <= 0) return a1 + a2;
        return a2 + a1;
    }

    public static void main(String[] args) throws Exception {
        FastReader in = new FastReader();

        String a, b;
        a = in.next();
        b = in.next();

        String result;
        result = (smallest(a).compareTo(smallest(b)) == 0 ? "YES": "NO");

        System.out.println(result);

    }

}


import java.util.Scanner;

public class A {
	static long mod = 5000001;

	public static void main(String[] args) {

		Scanner nik = new Scanner(System.in);

		String s1 = nik.next();
		String s2 = nik.next();
		boolean b = false;
		if (s1.equals(s2)) {
			b = true;
		} else if (s1.length() % 2 == 0) {

			String temp1 = s1.substring(0, s1.length() / 2);
			String temp2 = s1.substring(s1.length() / 2, s1.length());
			String temp3 = s2.substring(0, s2.length() / 2);
			String temp4 = s2.substring(s2.length() / 2, s2.length());

			if (check(temp1, temp3) && check(temp3, temp4)) {
				b = true;
			} else if (check(temp1, temp4) && check(temp2, temp3)) {
				b = true;
			}
		}
		if (b) {
			System.out.println("YES");
		} else {
			System.out.println("NO");
		}
	}

	private static boolean check(String s1, String s2) {

		int[] b = new int[26];
		for (int i = 0; i < s1.length(); i++) {
			b[s1.charAt(i) - 'a']++;
		}
		for (int i = 0; i < s2.length(); i++) {
			b[s2.charAt(i) - 'a']--;
		}
		boolean f = true;

		for (int i = 0; i < b.length; i++) {
			if (b[i] != 0) {
				f = false;
				break;
			}
		}
		return f;
	}

}


import java.util.Scanner;

public class A {
	static long mod = 5000001;

	public static void main(String[] args) {

		Scanner nik = new Scanner(System.in);

		String s1 = nik.next();
		String s2 = nik.next();
		boolean b = false;
		if (s1.compareTo(s2) == 0) {
			b = true;
		} else if (s1.length() % 2 == 0) {

			String temp1 = s1.substring(0, s1.length() / 2);
			String temp2 = s1.substring(s1.length() / 2, s1.length());
			if (temp1.compareTo(temp2) >= 0) {
				s1 = temp2 + temp1;
			}
			String temp3 = s2.substring(0, s2.length() / 2);
			String temp4 = s2.substring(s2.length() / 2, s2.length());

			if (temp3.compareTo(temp4) >= 0) {
				s2 = temp4 + temp2;
			}
			if (s1.compareTo(s2) == 0) {
				b = true;
			}
		}
		if (b) {
			System.out.println("YES");
		} else {
			System.out.println("NO");
		}
	}

	private static boolean check(String s1, String s2) {

		int[] b = new int[26];
		for (int i = 0; i < s1.length(); i++) {
			b[s1.charAt(i) - 'a']++;
		}
		for (int i = 0; i < s2.length(); i++) {
			b[s2.charAt(i) - 'a']--;
		}
		boolean f = true;

		for (int i = 0; i < b.length; i++) {
			if (b[i] != 0) {
				f = false;
				break;
			}
		}
		return f;
	}

}


import java.util.Scanner;

public class A {
	static long mod = 5000001;

	public static void main(String[] args) {

		Scanner nik = new Scanner(System.in);

		String s1 = nik.next();
		String s2 = nik.next();
		boolean b = false;

		System.out.println(get(s1).compareTo(get(s2)) == 0 ? "YES" : "NO");

	}

	private static String get(String s1) {
		int n = s1.length();
		if (s1.length() % 2 != 0) {
			return s1;
		}
		String temp1 = get(s1.substring(0, n >> 1));
		String temp2 = get(s1.substring(n >> 1, s1.length()));

		if (temp1.compareTo(temp2) < 0) {
			return temp1 + temp2;
		}
		return temp2 + temp1;
	}

}


import java.util.Scanner;

public class A {
	static long mod = 5000001;

	public static void main(String[] args) {

		Scanner nik = new Scanner(System.in);

		String s1 = nik.next();
		String s2 = nik.next();
		boolean b = false;
		if (s1.compareTo(s2) == 0) {
			b = true;
		} else {

			String temp1 = s1.substring(0, s1.length() / 2);
			String temp2 = s1.substring(s1.length() / 2, s1.length());
			if (temp1.compareTo(temp2) >= 0) {
				s1 = temp2 + temp1;
			}
			String temp3 = s2.substring(0, s2.length() / 2);
			String temp4 = s2.substring(s2.length() / 2, s2.length());

			if (temp3.compareTo(temp4) >= 0) {
				s2 = temp4 + temp2;
			}
			if (s1.compareTo(s2) == 0) {
				b = true;
			}
		}
		if (b) {
			System.out.println("YES");
		} else {
			System.out.println("NO");
		}
	}

	private static boolean check(String s1, String s2) {

		int[] b = new int[26];
		for (int i = 0; i < s1.length(); i++) {
			b[s1.charAt(i) - 'a']++;
		}
		for (int i = 0; i < s2.length(); i++) {
			b[s2.charAt(i) - 'a']--;
		}
		boolean f = true;

		for (int i = 0; i < b.length; i++) {
			if (b[i] != 0) {
				f = false;
				break;
			}
		}
		return f;
	}

}


import java.util.Scanner;

public class A {
	static long mod = 5000001;

	public static void main(String[] args) {

		Scanner nik = new Scanner(System.in);

		String s1 = nik.next();
		String s2 = nik.next();
		boolean b = false;
		if (s1.compareTo(s2) == 0) {
			b = true;
		} else if (s1.length() % 2 == 0) {

			String temp1 = s1.substring(0, s1.length() / 2);
			String temp2 = s1.substring(s1.length() / 2, s1.length());
			if (temp1.compareTo(temp2) >= 0) {
				s1 = temp2 + temp1;
			}
			String temp3 = s2.substring(0, s2.length() / 2);
			String temp4 = s2.substring(s2.length() / 2, s2.length());

			if (temp3.compareTo(temp4) >= 0) {
				s2 = temp4 + temp3;
			}
			if (s1.compareTo(s2) == 0) {
				b = true;
			}
		}
		if (b) {
			System.out.println("YES");
		} else {
			System.out.println("NO");
		}
	}

	private static boolean check(String s1, String s2) {

		int[] b = new int[26];
		for (int i = 0; i < s1.length(); i++) {
			b[s1.charAt(i) - 'a']++;
		}
		for (int i = 0; i < s2.length(); i++) {
			b[s2.charAt(i) - 'a']--;
		}
		boolean f = true;

		for (int i = 0; i < b.length; i++) {
			if (b[i] != 0) {
				f = false;
				break;
			}
		}
		return f;
	}

}


import java.io.*;
import java.util.*;
import java.awt.*;

public class Main {
    public static void main(String[] args) throws Exception {
        FastReader sc = new FastReader();
        StringBuilder sb=new StringBuilder();
        String a=sc.next(),b=sc.next();
        if(check(a,b)) System.out.println("YES");
        else System.out.println("NO");
    }
    static boolean check(String a,String b){
        if(a.length()==1 && b.length()==1){
            if(a.charAt(0)==b.charAt(0))return true;
            else return false;
        }
        if(a.length()!=b.length())return false;
        if(a.equals(b))return true;
        if(a.length()%2==1)return false;
        String a1=a.substring(0,a.length()/2),a2=a.substring(a.length()/2,a.length());
        String b1=b.substring(0,b.length()/2),b2=b.substring(b.length()/2,b.length());
        return (check(a1,b1) && check(a2,b2)) || (check(a1,b2) && check(a2,b1));
    }
}
class FastReader {
    BufferedReader br;
    StringTokenizer st;

    public FastReader() {
        br = new BufferedReader(new
                InputStreamReader(System.in));
    }
    String next() {
        while (st == null || !st.hasMoreElements()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return st.nextToken();
    }
    int nextInt() { return Integer.parseInt(next()); }
    long nextLong() { return Long.parseLong(next()); }
    double nextDouble() { return Double.parseDouble(next()); }
    String nextLine() {
        String str = "";
        try {
            str = br.readLine();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return str;
    }
}


import java.io.*;
import java.util.*;
import java.awt.*;

public class Main {
    static HashSet<String> hs=new HashSet<>();
    public static void main(String[] args) throws Exception {
        FastReader sc = new FastReader();
        StringBuilder sb=new StringBuilder();
        String a=sc.next(),b=sc.next();
        if(check(a,b)) System.out.println("YES");
        else System.out.println("NO");
    }
    static boolean check(String a,String b){
        if(hs.contains(a+b))return true;
        if(a.length()==1 && b.length()==1){
            if(a.charAt(0)==b.charAt(0))return true;
            else return false;
        }
        if(a.length()!=b.length())return false;
        if(a.equals(b))return true;
        if(a.length()%2==1)return false;
        String a1=a.substring(0,a.length()/2),a2=a.substring(a.length()/2,a.length());
        String b1=b.substring(0,b.length()/2),b2=b.substring(b.length()/2,b.length());
        boolean z=((check(a1,b1) && check(a2,b2)) || (check(a1,b2) && check(a2,b1)));
        if(z)hs.add(a+b);
        return z;
    }
}
class FastReader {
    BufferedReader br;
    StringTokenizer st;

    public FastReader() {
        br = new BufferedReader(new
                InputStreamReader(System.in));
    }
    String next() {
        while (st == null || !st.hasMoreElements()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return st.nextToken();
    }
    int nextInt() { return Integer.parseInt(next()); }
    long nextLong() { return Long.parseLong(next()); }
    double nextDouble() { return Double.parseDouble(next()); }
    String nextLine() {
        String str = "";
        try {
            str = br.readLine();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return str;
    }
}


import java.io.*;
import java.util.*;
import java.awt.*;

public class Main {
    public static void main(String[] args) throws Exception {
        FastReader sc = new FastReader();
        StringBuilder sb=new StringBuilder();
        String a=sc.next(),b=sc.next();
        if(check(a,b)) System.out.println("YES");
        else System.out.println("NO");
    }
    static boolean check(String a,String b){
        if(a.length()==1 && b.length()==1){
            if(a.charAt(0)==b.charAt(0))return true;
            else return false;
        }
        if(a.length()!=b.length())return false;
        if(a.equals(b))return true;
        String a1=a.substring(0,a.length()/2),a2=a.substring(a.length()/2,a.length());
        String b1=b.substring(0,b.length()/2),b2=b.substring(b.length()/2,b.length());
        return (check(a1,b1) && check(a2,b2)) || (check(a1,b2) && check(a2,b1));
    }
}
class FastReader {
    BufferedReader br;
    StringTokenizer st;

    public FastReader() {
        br = new BufferedReader(new
                InputStreamReader(System.in));
    }
    String next() {
        while (st == null || !st.hasMoreElements()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return st.nextToken();
    }
    int nextInt() { return Integer.parseInt(next()); }
    long nextLong() { return Long.parseLong(next()); }
    double nextDouble() { return Double.parseDouble(next()); }
    String nextLine() {
        String str = "";
        try {
            str = br.readLine();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return str;
    }
}


import java.io.*;
import java.util.*;
import java.awt.*;

public class Main {
    public static void main(String[] args) throws Exception {
        FastReader sc = new FastReader();
        StringBuilder sb=new StringBuilder();
        String a=sc.next(),b=sc.next();
        if(check(a,b)) System.out.println("YES");
        else System.out.println("NO");
    }
    static boolean check(String a,String b){
        if(a.length()==1 && b.length()==1){
            if(a.charAt(0)==b.charAt(0))return true;
            else return false;
        }
        if(a.length()!=b.length() || a.length()%2==1)return false;
        if(a.equals(b))return true;
        String a1=a.substring(0,a.length()/2),a2=a.substring(a.length()/2,a.length());
        String b1=b.substring(0,b.length()/2),b2=b.substring(b.length()/2,b.length());
        return (check(a1,b1) && check(a2,b2)) || (check(a1,b2) && check(a2,b1));
    }
}
class FastReader {
    BufferedReader br;
    StringTokenizer st;

    public FastReader() {
        br = new BufferedReader(new
                InputStreamReader(System.in));
    }
    String next() {
        while (st == null || !st.hasMoreElements()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return st.nextToken();
    }
    int nextInt() { return Integer.parseInt(next()); }
    long nextLong() { return Long.parseLong(next()); }
    double nextDouble() { return Double.parseDouble(next()); }
    String nextLine() {
        String str = "";
        try {
            str = br.readLine();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return str;
    }
}


import java.util.Scanner;

public class _559B {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String a = scan.nextLine();
		String b = scan.nextLine();
		boolean equivalent = equivalent(a, b);
		if (equivalent) {
			System.out.println("YES");
		}
		else {
			System.out.println("NO");
		}

		scan.close();
	}

	public static boolean equivalent(String a, String b) {
		if (a.length() % 2 != 0 || b.length() % 2 != 0) {
			if (a.equals(b)) {
				return true;
			}
			else {
				return false;
			}
		}
		else {
			if (a.length() == b.length()) {
				if (a.equals(b)) {
					return true;
				}
				else {
					String a1 = a.substring(0, a.length()/2);
					String b1 = b.substring(0, b.length()/2);
					String a2 = a.substring(a.length()/2, a.length());
					String b2 = b.substring(b.length()/2, b.length());
					return (equivalent(a1, b1)
							&& equivalent(a2, b2))
							|| (equivalent(a1, b2)
									&& equivalent(a2, b1));
				}
			}
			else {
				return false;
			}
		}
	}

}


import java.util.Scanner;

public class _559B {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String a = scan.nextLine();
		String b = scan.nextLine();
		boolean equivalent = equivalent(a, b, 0, a.length(), 0, b.length());
		if (equivalent) {
			System.out.println("YES");
		}
		else {
			System.out.println("NO");
		}

		scan.close();
	}

	public static boolean equivalent(String a, String b, int aStart, int aEnd, int bStart, int bEnd) {
		int aLength = aEnd - aStart;
		int bLength = bEnd - bStart;
		if (aLength % 2 != 0 || bLength % 2 != 0) {
			if (a.substring(aStart, aEnd).equals(b.substring(bStart, bEnd))) {
				return true;
			}
			else {
				return false;
			}
		}
		else {
			if (aLength == bLength) {
				if ((equivalent(a, b, aStart, aStart + aLength/2, bStart, bStart + bLength/2)
						&& equivalent(a, b, aStart + aLength/2, aStart + aLength, bStart + bLength/2, bStart + bLength))
						|| (equivalent(a, b, aStart, aStart + aLength/2, bStart + bLength/2, bStart + bLength)
								&& equivalent(a, b, aStart + aLength/2, aStart + aLength, bStart, bStart + bLength/2))) {
					return true;
				}
				else {
					return a.substring(aStart, aEnd).equals(b.substring(bStart, bEnd));
				}
			}
			else {
				return false;
			}
		}
	}

}


import java.util.Scanner;

public class _559B {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String a = scan.nextLine();
		String b = scan.nextLine();
		boolean equivalent = equivalent(a, b);
		if (equivalent) {
			System.out.println("YES");
		}
		else {
			System.out.println("NO");
		}

		scan.close();
	}

	public static boolean equivalent(String a, String b) {
		if (a.length() % 2 != 0 || b.length() % 2 != 0) {
			if (a.equals(b)) {
				return true;
			}
			else {
				return false;
			}
		}
		else {
			if (a.length() == b.length()) {
				if (a.equals(b)) {
					return true;
				}
				else {
					return (equivalent(a.substring(0, a.length()/2), b.substring(0, b.length()/2))
							&& equivalent(a.substring(a.length()/2, a.length()), b.substring(b.length()/2, b.length())))
							|| (equivalent(a.substring(0, a.length()/2), b.substring(b.length()/2, b.length()))
									&& equivalent(a.substring(a.length()/2, a.length()), b.substring(0, b.length()/2)));
				}
			}
			else {
				return false;
			}
		}
	}

}


import java.util.Scanner;

public class _559B {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String a = smallest(scan.nextLine());
		String b = smallest(scan.nextLine());
		if (a.equals(b)) {
			System.out.println("YES");
		}
		else {
			System.out.println("NO");
		}

		scan.close();
	}

	public static String smallest(String string) {
		if (string.length() % 2 == 1) {
			return string;
		}
		else {
			String string1 = smallest(string.substring(0, string.length()/2));
			String string2 = smallest(string.substring(string.length()/2, string.length()));
			if (string1.compareTo(string2) < 0) {
				return string1.concat(string2);
			}
			else {
				return string2.concat(string1);
			}
		}
	}

}


import java.util.Scanner;

public class _559B {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String a = scan.nextLine();
		String b = scan.nextLine();
		boolean equivalent = equivalent(a, b);
		if (equivalent) {
			System.out.println("YES");
		}
		else {
			System.out.println("NO");
		}

		scan.close();
	}

	public static boolean equivalent(String a, String b) {
		if (a.length() % 2 != 0 || b.length() % 2 != 0) {
			if (a.equals(b)) {
				return true;
			}
			else {
				return false;
			}
		}
		else {
			if (a.length() == b.length()) {
				if (a.equals(b)) {
					return true;
				}
				else {
					String a1 = a.substring(0, a.length()/2);
					String b1 = b.substring(0, b.length()/2);
					return (equivalent(a1, b1)
							&& equivalent(a.substring(a.length()/2, a.length()), b.substring(b.length()/2, b.length())))
							|| (equivalent(a1, b.substring(b.length()/2, b.length()))
									&& equivalent(a.substring(a.length()/2, a.length()), b1));
				}
			}
			else {
				return false;
			}
		}
	}

}


import java.util.Scanner;

public class _559B {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String a = scan.nextLine();
		String b = scan.nextLine();
		boolean equivalent = equivalent(a, b, 0, a.length(), 0, b.length());
		if (equivalent) {
			System.out.println("YES");
		}
		else {
			System.out.println("NO");
		}

		scan.close();
	}

	public static boolean equivalent(String a, String b, int aStart, int aEnd, int bStart, int bEnd) {
		int aLength = aEnd - aStart;
		int bLength = bEnd - bStart;
		if (aLength % 2 != 0 || bLength % 2 != 0) {
			if (a.substring(aStart, aEnd).equals(b.substring(bStart, bEnd))) {
				return true;
			}
			else {
				return false;
			}
		}
		else {
			if (aLength == bLength) {
				if (a.substring(aStart, aEnd).equals(b.substring(bStart, bEnd))) {
					return true;
				}
				else {
					return (equivalent(a, b, aStart, aStart + aLength/2, bStart, bStart + bLength/2)
							&& equivalent(a, b, aStart + aLength/2, aStart + aLength, bStart + bLength/2, bStart + bLength))
							|| (equivalent(a, b, aStart, aStart + aLength/2, bStart + bLength/2, bStart + bLength)
									&& equivalent(a, b, aStart + aLength/2, aStart + aLength, bStart, bStart + bLength/2));
				}
			}
			else {
				return false;
			}
		}
	}

}


import java.util.Scanner;

public class EquivalentStrings {
    static boolean equalStrings(String s1 , String s2){
        if(partition(s1).compareTo(partition(s2)) == 0) return true;
        else return false;
    }

    static String partition(String s){
        if(s.length()%2 ==1) return s;
        else{
            String s1 = partition(s.substring(0, s.length()/2));
            String s2 = partition(s.substring(s.length()/2, s.length()));
            if(s1.compareTo(s2)<0) return s1+s2;
            else return s2+s1;
        }
    }

    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String s1 = sc.nextLine();
        String s2 = sc.nextLine();
        EquivalentStrings  obj = new EquivalentStrings();
        boolean flag = obj.equalStrings(s1, s2);
        if(flag) System.out.println("YES");
        else System.out.println("NO");
    }
}


import java.util.Scanner;

public class EquivalentStrings {
    static boolean equalStrings(String s1 , String s2){
        return !(partition(s1).equals(partition(s2)));
    }

    static String partition(String s){
        if(s.length()==1) return s;
        else{
            String s1 = partition(s.substring(0, s.length()/2));
            String s2 = partition(s.substring(s.length()/2, s.length()));
            return String.valueOf((s1 + s2).compareTo(s2 + s1));
        }
    }

    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String s1 = sc.nextLine();
        String s2 = sc.nextLine();
        EquivalentStrings  obj = new EquivalentStrings();
        boolean flag = obj.equalStrings(s1, s2);
        if(flag) System.out.println("YES");
        else System.out.println("NO");
    }
}


import java.util.Scanner;

public class EquivalentStrings {
    static boolean equalStrings(String s1 , String s2){
        if(partition(s1).compareTo(partition(s2)) == 0) return true;
        else return false;
    }

    static String partition(String s){
        if(s.length()==1) return s;
        else{
            String s1 = partition(s.substring(0, s.length()/2));
            String s2 = partition(s.substring(s.length()/2, s.length()));
            if(s1.compareTo(s2) > 0) return s1+s2;
            else return s2+s1;
        }
    }

    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String s1 = sc.nextLine();
        String s2 = sc.nextLine();
        EquivalentStrings  obj = new EquivalentStrings();
        boolean flag = obj.equalStrings(s1, s2);
        if(flag) System.out.println("YES");
        else System.out.println("NO");
    }
}


import java.util.Scanner;

public class EquivalentStrings {
    static boolean equalStrings(String s1 , String s2){
        if(s1.compareTo(s2) == 0){
            return true;
        }
        else{
            boolean flag = partition(s1, s2);
            return flag;
        }
    }

    static boolean partition(String s1, String s2){
        String s11 = s1.substring(0, s1.length()/2);
        String s12 = s1.substring(s1.length()/2 , s1.length());
        String s21 = s2.substring(0, s2.length()/2);
        String s22 = s2.substring(s2.length()/2 , s2.length());
        if(s11.compareTo(s21) ==0 && s12.compareTo(s22) == 0){
            return true;
        }
        else if(s12.compareTo(s21) ==0 && s11.compareTo(s22) == 0){
            return true;
        }
        else{
            int[] a11 = new int[26];
            int[] a12 = new int[26];
            int[] a21 = new int[26];
            int[] a22 = new int[26];
            for(int i =0 ; i< s11.length(); i++) a11[(int)(s11.charAt(i)) -97] += 1;
            for(int i =0 ; i< s12.length(); i++) a12[(int)(s12.charAt(i)) -97] += 1;
            for(int i =0 ; i< s21.length(); i++) a21[(int)(s21.charAt(i)) -97] += 1;
            for(int i =0 ; i< s22.length(); i++) a22[(int)(s22.charAt(i)) -97] += 1;
            boolean flag11= true, flag12= true, flag21= true, flag22 = true;
            for(int i = 0; i< 26; i++){
                if(a11[i] != a21[i]) flag11 = false;
                if(a11[i] != a22[i]) flag12 = false;
                if(a12[i] != a21[i]) flag21 = false;
                if(a12[i] != a22[i]) flag22 = false;
            }
            if(flag11 && flag22) return true;
            else if(flag21 && flag12) return true;
        }
        return false;
    }

    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String s1 = sc.nextLine();
        String s2 = sc.nextLine();
        EquivalentStrings  obj = new EquivalentStrings();
        boolean flag = obj.equalStrings(s1, s2);
        if(flag) System.out.println("YES");
        else System.out.println("NO");
    }
}