import java.io.*; import java.util.*; class Main69 { public static char[] getCharSeq (String s) { char[] ret = new char[26]; for (int i = 0; i < s.length(); i++) ret[(int)s.charAt(i) - 97]++; return ret; } public static void main (String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String a = br.readLine(); String b = br.readLine(); System.out.println(Arrays.equals(getCharSeq(a),getCharSeq(b)) ? "YES" : "NO"); } }