using System;
using System.Linq;

public class Program
{
    public static void Main(string[] args)
    {
        var s1 = new string( Console.ReadLine().ToCharArray().OrderBy(x => x).ToArray());
        var s2 = new string( Console.ReadLine().ToCharArray().OrderBy(x => x).ToArray());
        Console.WriteLine((s1 == s2) ? "YES" : "NO");
    }            
}