using System;
using System.Linq;
public class Hello
{
    public static void Main()
    {
        string line = System.Console.ReadLine().Trim();
        string x = line;
        string[] x2 = new string[x.Length];
        line = System.Console.ReadLine().Trim();
        string y = line;
        string[] y2 = new string[x.Length];


        for (int i = 0; i < x.Length; i++)
        {
            x2[i] += x[i];
            y2[i] += y[i];
        }

        Array.Sort(x2);
        Array.Sort(y2);


        if (x2.SequenceEqual(y2))
        {
            System.Console.WriteLine("YES");
        }
        else
        {
            System.Console.WriteLine("NO");
        }
    }
}