import java.util.*; import java.lang.*; import java.io.*; class Main { public static void main (String[] args) { // 入力値の読み込み Scanner sc = new Scanner(System.in); String a = sc.next(); String b = sc.next(); char[]ca = a.toCharArray(); char[]cb = b.toCharArray(); Arrays.sort(ca); String sortedca = new String(ca); Arrays.sort(cb); String sortedcb = new String(cb); if(sortedca.equals(sortedcb)){ System.out.println("YES"); }else{ System.out.println("NO"); } } }