import java.util.HashMap; import java.util.Scanner; public class Main{ static final Scanner s=new Scanner(System.in); public static void main(String args[]){ Counter a=new Counter<>(26), b=new Counter<>(26); for(char c:s.next().toCharArray()) a.add(c); for(char c:s.next().toCharArray()) b.add(c); System.out.println(a.map.equals(b.map)?"YES":"NO"); } } class Counter{ public HashMap map; public Counter(int initSize){ map=new HashMap<>(initSize); } public Counter(){ this(10); } public void add(T key, int v){ Integer i; if((i=map.get(key))==null){ map.put(key,v); }else{ map.put(key,i+v); } } public void add(T key){ add(key,1); } }