using System;

namespace debug
{
    class Program
    {
        static void Main(string[] args)
        {
            ProgramC a = new ProgramC();
            a.main();

        }
    }

    //ABC110
    class ProgramA
    {
        public void main()
        {
            string s1 = Console.ReadLine();
            string s2 = Console.ReadLine();

            if (s1[0] == s2[2] && s1[1] == s2[1] && s1[2] == s2[0])
                Console.WriteLine("YES");
            else
                Console.WriteLine("NO");
        }
    }

    class ProgramB
    {
        public void main()
        {
            long n = long.Parse(Console.ReadLine());
            for (long i = 1; i < 100000; i++)
            {
                if (i * i > n)
                {
                    Console.WriteLine((i - 1) * (i - 1));
                    return;
                }

            }
        }
    }

    class ProgramC
    {
        public void main()
        {
            string s = Console.ReadLine();
            string t = Console.ReadLine();

            int[] s_al = new int[26];
            int[] t_al = new int[26];
            for(int i = 0;i < s.Length;i++)
            {
                s_al[s[i] - 'a']++;
                t_al[t[i] - 'a']++;
            }

            Array.Sort(s_al);
            Array.Sort(t_al);
            for (int i = 0;i < 26;i++)
            {
                if (s_al[i] != t_al[i])
                {
                    Console.WriteLine("No");
                    return;
                }
            }
            Console.WriteLine("Yes");
        }
    }


    //ACしてないです。
    class ProgramD
    {
        public void main()
        {
            string[] s = Console.ReadLine().Split(' ');
            long n = long.Parse(s[0]); 
            long m = long.Parse(s[1]);
            long t = m;
            long count = 0;
            long[] fac = new long[n + 1];

            
            for(long i = 2;i <= Math.Sqrt(m);i++)
            {
                if(t % i == 0)
                {
                    while (t % i == 0)
                    {
                        t /= i;
                        fac[count]++;
                    }
                    count++;
                }

            }

            if(t != 1)
            {
                fac[count]++;
                count++;
            }

            long MOD = 1000000000 + 7;
            long sum = 1;

            //下準備
            nCk com = new nCk();
            com.fac = new long[n + 50];
            com.inv = new long[n + 50];
            com.finv = new long[n + 50];
            com.mod = MOD;
            com.max = n + 50;

            //メモ作成
            com.com_init();

            
            for (int i = 0;i < count;i++)
            {
                sum *= com.com(n + fac[i] - 1, fac[i]);
                sum %= MOD;
            }

            Console.WriteLine(sum);
        }

    }

    class nCk
    {
        public long mod;
        public long max;
        public long[] fac;
        public long[] inv;
        public long[] finv;


        //メモ作成(前準備)
        public void com_init()
        {
            fac[0] = 1;
            fac[1] = 1;
            finv[0] = 1;
            finv[1] = 1;
            inv[1] = 1;
            for (long i = 2; i < max; i++)
            {
                fac[i] = i * fac[i - 1] % mod;
                inv[i] = mod - inv[mod % i] * (mod / i) % mod;
                finv[i] = finv[i - 1] * inv[i] % mod;
            }
        }

        //二項計算
        public long com(long n, long k)
        {
            if (n < 0 || k < 0)
                return 0;
            if (n < k)
                return 0;
            return fac[n] * (finv[n - k] * finv[k] % mod) % mod;
        }

    }


}


Measured memory_bytes: 12512