using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Security;
using System.Security.Permissions;

namespace yukicore
{
    internal class Program
    {
        private static void Main()
        {
            char[] array = Console.ReadLine().ToCharArray();
            char[] array2 = Console.ReadLine().ToCharArray();
            Array.Sort<char>(array);
            Array.Sort<char>(array2);
            for (int i = 0; i < array.Length; i++)
            {
                if (array[i] != array2[i])
                {
                    Console.WriteLine("NO");
                    return;
                }
            }
            Console.WriteLine("YES");
        }
    }
}