import java.util.Arrays; import java.util.Scanner; class Character { static boolean equals(char[] c1, char[] c2) { Arrays.sort(c1); Arrays.sort(c2); for (int i = 0; i < c1.length; i++) { if (c1[i] != c2[i]) { return false; } } return true; } } public class No_69{ public static void main(String[] args) { Scanner sc = new Scanner(System.in); String ans = ""; char[] c1 = sc.next().toCharArray(); char[] c2 = sc.next().toCharArray(); if (Character.equals(c1, c2)) ans = "YES"; else ans = "NO"; System.out.println(ans); sc.close(); } }