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



/**
 * Created by IntelliJ IDEA.
 * User: m09cke
 * Date: 21.10.2009
 * Time: 17:10:40
 * To change this template use File | Settings | File Templates.
 */
public class Main {
    public static void main(String[] args)throws FileNotFoundException{
        Scanner in = new Scanner(new File("anagrams.in"));
        PrintWriter out = new PrintWriter("anagrams.out");
        char[] first = in.next().toCharArray();
        char[] second = in.next().toCharArray();
        /*String f=in.next();
        String s=in.next();
        char[] first =new char[ f.length() ];
        char[] second=new char[ s.length() ];
        for (int i=0;i<first.length;i++){
            first[i]=f.charAt(i);
        }
        for (int i=0;i<s.length();i++){
            second[i]=s.charAt(i);
        }*/
        Arrays.sort(first);
        Arrays.sort(second);
        boolean t=true;
        if (first.length==second.length){
            for(int i=0;i<second.length;i++){
                if (first[i]!=second[i]) {t=false;}
            }
        }
        else
        t=false;
        if (t==true) out.print("YES");
        else out.print("NO");


        out.close();
    }
}
