/**
 * Created by IntelliJ IDEA.
 * User: o_220
 * Date: 21.10.2009
 * Time: 18:43:33
 * To change this template use File | Settings | File Templates.
 */   import java.util.*;
    import java.io.*;
public class Main {
    public static void main(String[] args) throws Exception{
        Scanner s= new Scanner(new File("anagrams.in"));
        PrintWriter p= new PrintWriter (new File("anagrams.out"));
        char [] c1 = s.next().toCharArray();
        int l1 = c1.length;
        char [] c2 = s.next().toCharArray();
        int l2 = c2.length;
        char c;

        if (l1 != l2) {
            p.println("NO");
        }   else {
            for (int i=0; i < l2; i++) { 
                for (int j=i; j < l2; j++) {
                    if (c2 [j] == c1 [i]) {
                        c= c2 [i];
                        c2 [i] = c2 [j];
                        c2 [j] = c;
                        break;
                    }
                 }
                if (c1 [i] != c2 [i]) {
                    p.println("NO");
                    break;
                }

                if (i==l2-1) {
                    p.println("YES");
                }
            }
        }
        s.close();
        p.close();
    }
}
