/*
 * Created on 01.12.2004
 *
 * TODO To change the template for this generated file go to
 * Window - Preferences - Java - Code Style - Code Templates
 */

/**
 * @author B21
 *
 * TODO To change the template for this generated type comment go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
import java.io.*;
import java.lang.*;
import java.math.*;
import java.util.*;

public class AncientChiper {

	public static void main(String[] args) throws IOException{
		StreamTokenizer in = new StreamTokenizer(new FileReader("ancient.in"));
		in.nextToken();
		String s = in.sval;
		while (in.nextToken() != StreamTokenizer.TT_WORD) ;
		String s2 = in.sval;
		char[] carr = (s.toUpperCase()).toCharArray();
		Arrays.sort(carr);
		char[] carr2 = (s2.toUpperCase()).toCharArray();
		Arrays.sort(carr2);
		boolean b = true;
		int num = -1000;
		for (int i= 0; i< carr.length;i++){
			int c = (int)(carr[i]-carr2[i]);
			if (c!=0 && c!=num){
				if (num!=-1000){
					b=false;
					break;
					}
				num=c;
				}
			}
		FileWriter fw = new FileWriter("ancient.out");
		if (b){
			fw.write("YES");
			} else {fw.write("NO");}
		fw.close();
	}
}
