import java.util.*; class Main { static Scanner sc = new Scanner(System.in); public static void main(String[] args) { char[] a = sc.next().toCharArray(); char[] b = sc.next().toCharArray(); Arrays.sort(a); Arrays.sort(b); System.out.println(String.valueOf(a).equals(String.valueOf(b))?"YES":"NO"); } }