/**
 * Created by IntelliJ IDEA.
 * User: m09aaa
 * Date: 07.09.2009
 * Time: 14:11:09
 * To change this template use File | Settings | File Templates.
 */
import java.util.*;
import java.io.*;

   public class nusya {
        public static void main ( String[] args ) throws Exception
        {
            Scanner in=new Scanner (new File("anagrams.in"));
            PrintWriter out=new PrintWriter (new File("anagrams.out"));
            String s1=in.next();
            String s2=in.next();
            String otv="YES";
            if (s1.length()!=s2.length())
            {
                otv="NO";
            }
            else
            {
                if (!s1.equalsIgnoreCase(s2))
                {
                    s1=s1.toLowerCase();
                    s2=s2.toLowerCase();
                    int i=0;
                    while ( i<26)
                    {
                        int kol=0;
                        for (int j=0; j<s1.length(); j++)
                        {   if (s1.charAt(j)-'a'==i)
                            {kol++;}
                            if (s2.charAt(j)-'a'==i)
                            {kol--;}}
                        if (kol!=0)
                        {otv="NO";
                            i=26;}
                         else {i++;}
                   }
                }
            }
            out.println(otv);
            out.close ();
        }
   }

