import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String A = sc.next(); String B = sc.next(); String ans = "YES"; for(char c = 'a'; c <= 'z'; c++) { int na = 0; int nb = 0; for(int i = 0; i < A.length(); i++) { if(A.charAt(i) == c) na++; if(B.charAt(i) == c) nb++; } if(na != nb) { ans = "NO"; break; } } System.out.println(ans); } }