import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.HashMap; import java.util.Map; public class No00000069_Main { 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(check(getCnt(a), getCnt(b))); } private static Map getCnt(String str) { Map ret = new HashMap(); char[] cArr = str.toCharArray(); for(char c : cArr) { String s = String.valueOf(c); if(ret.containsKey(s)) { ret.put(s, ret.get(s) + 1); } else { ret.put(s, 1); } } return ret; } private static String check(Map aMap, Map bMap) { for(Map.Entry ent : aMap.entrySet()) { if(!(bMap.containsKey(ent.getKey()) && (bMap.get(ent.getKey()) == ent.getValue()))) { return "NO"; } } return "YES"; } }