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

namespace yukicoder_69 {
    class Program {
        static void Main(string[] args) {
            char[] a = Console.ReadLine().ToCharArray();
            char[] b = Console.ReadLine().ToCharArray();
            Array.Sort(a);
            Array.Sort(b);
            int c = 0;
            for(int i = 0; i < a.Length; i++) {
                if (a[i] != b[i]) {
                    c++;
                }
            }
            if (c > 0) {
                Console.WriteLine("NO");
            } else {
                Console.WriteLine("YES");
            }
            Console.ReadLine();
        }
    }
}