/**
 * Created by IntelliJ IDEA.
 * User: o_215
 * Date: 21.10.2009
 * Time: 18:46:59
 * To change this template use File | Settings | File Templates.
 */
import java.util.*;
import java.io.*;

public class C {
public static void main(String[] args) throws Exception{
    Scanner in=new Scanner(new File("anagrams.in"));
    PrintWriter out=new PrintWriter(new File("anagrams.out"));
    char[] f=in.nextLine().toCharArray();
    char[] s=in.nextLine().toCharArray();
    boolean b=true;
    if (f.length==s.length){
        int i=0;
        while (b && i<s.length){
            b=false;int j=i;
            while (!b && j<s.length){
                if(s[i]==f[j]){f[j]=f[i]; f[i]=s[j]; b=true;}
                j++;
            }
            i++;
        }
    }else{
        b=false;
    }
    out.println(b?"YES":"NO");
    in.close();
    out.close();
}
}
