import java.util.Scanner;
import java.util.Arrays;
import java.io.File;
import java.io.PrintWriter;

/**
 * Created by IntelliJ IDEA.
 * User: o_242
 * Date: 21.10.2009
 * Time: 19:04:17
 * To change this template use File | Settings | File Templates.
 */
public class anagrams {
     public static void main (String[] args) throws Exception
    {
        Scanner in = new Scanner(new File ("anagrams.in"));
        PrintWriter out = new PrintWriter(new File ("anagrams.out"));
        String s1 = in.nextLine();
        String s2 = in.nextLine();
        int l1 = s1.length();
        String [] A = new String[l1];
        int l2 = s2.length();
        String [] B = new String[l2];
        for (int i=0; i<l1; ++i)
        {
            char ch = s1.charAt(i);
            int x = ch - '0';
            A[i] = Integer.toString(x);
        }
        for (int j=0; j<l2; ++j)
        {
            char ch1 = s2.charAt(j);
            int x = ch1 - '0';
            B[j] = Integer.toString(x);
        }
        Arrays.sort(A);
        Arrays.sort(B);
        String s11 = "";
        for (int i=0; i<l1; ++i)
        {
             s11 = s11 + A[i];
        }
        String s22 = "";
        for (int i=0; i<l2; ++i)
        {
             s22 = s22 + B[i];
        }

        if (s11.equals(s22))
        out.println("YES");
        else
        out.println("NO");

        out.close();
        in.close();
    }
}
