import java.util.*; import java.util.stream.*; public class Main{ public static void main(String... args){ Scanner sc=new Scanner(System.in); String a=sc.next(); String b=sc.next(); int[] aCount=new int[26]; int[] bCount=new int[26]; for(char c:a.toCharArray()){ aCount[c-'a']++; } for(char c:b.toCharArray()){ bCount[c-'a']++; } for(int i=0;i<26;i++){ if(aCount[i]!=bCount[i]){ put("NO"); return; } } put("YES"); } public static void print(Object object){ System.out.print(object); } public static void put(Object object) { System.out.println(object); } public static void put(){ System.out.println(); } public static void print(String format,Object... args){ System.out.print(String.format(format,args)); } public static void put(String format,Object... args) { System.out.println(String.format(format,args)); } }