import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Arrays; import java.util.List; public class Main { public static void main(String[] args) throws IOException { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); String A = reader.readLine(); String B = reader.readLine(); int[] as = new int[26]; for (int i = 0; i < A.length(); i++) { as[A.charAt(i) - 'a'] += 1; } int[] bs = new int[26]; for (int i = 0; i < B.length(); i++) { bs[B.charAt(i) - 'a'] += 1; } if(isSame(as,bs)) { System.out.println("YES"); } else { System.out.println("NO"); } } private static boolean isSame(int[] as, int[] bs) { for (int i = 0; i < 26; i++) { if (as[i] != bs[i]) { return false; } } return true; } }