using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

class Magatro
{
    
    static void Main()
    {
        string Abc = "qwertyuiopasdfghjklzxcvbnm";
        Dictionary<char, int> counter = new Dictionary<char, int>(); 
        for(int i = 0; i < 26; i++)
        {
            counter.Add(Abc[i], 0);
        }
        string A = Console.ReadLine();
        string B = Console.ReadLine();
        for(int i = 0; i < A.Length; i++)
        {
            counter[A[i]]++;
            counter[B[i]]--;
        }
        for(int i = 0; i < 26; i++)
        {
            if (counter[Abc[i]] != 0)
            {
                Console.WriteLine("NO");
                return;
            }
        }
        Console.WriteLine("YES");
    }
}