import java.util.*;
import java.io.*;

public class Anagram {
	public static void main(String[] args) throws Exception {
		Scanner in = new Scanner(new  File("anagrams.in"));
		PrintWriter out = new PrintWriter("anagrams.out");
		String s = in.nextLine();
		String s1 = in.nextLine();
		if (s.length()!=s1.length())
			out.print("NO");
		else{
				s = s.toLowerCase();
				s1 = s1.toLowerCase();
				int sum = 0;
				int sum1 = 0;
				for(int i = s.length()-1;i>=0;i--){
					sum += s.charAt(i)-'a';
					sum1 += s1.charAt(i)-'a';
					
				}
				
				if (sum == sum1){
					out.print("YES");
					
				}
				else out.print("NO");
			}
		
			
		
		
		out.close();
		in.close();
	
		
	}

}