import java.util.HashMap; import java.util.Map; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String a = sc.next(); String b = sc.next(); int n1 = a.length(); int n2 = b.length(); if(n1 != n2) { System.out.println("NO"); return; } Map map1 = new HashMap<>(); Map map2 = new HashMap<>(); for(char c = 'a' ; c <= 'z' ; c++) { map1.put("" + c, 0); map2.put("" + c, 0); } for(int i = 0 ; i < n1 ; i++) { map1.put("" + a.charAt(i), map1.get("" + a.charAt(i)) + 1); map2.put("" + b.charAt(i), map2.get("" + b.charAt(i)) + 1); } int cnt = 0; for(int i = 0 ; i < n1 ; i++) { if(map1.get("" + a.charAt(i)) == map2.get("" + a.charAt(i))) { cnt++; } } if(cnt == n1) { System.out.println("YES"); } else { System.out.println("NO"); } } }