using System;
using System.Linq;

class Program
{
    static void Main(string[] args)
    {
        // No.69 文字を自由に並び替え

        char[] A = Console.ReadLine().ToCharArray();
        char[] B = Console.ReadLine().ToCharArray();
        Array.Sort(A);
        Array.Sort(B);
        string Astr = new string(A);
        string Bstr = new string(B);

        if (Astr.Equals(Bstr))
            Console.WriteLine("YES");
        else
            Console.WriteLine("NO");
    }
}