def replace(A,B): count = [(i,A.count(i)) for i in B] for i in count: if B.count(i[0]) != i[1]: return "NO" return "YES" A = list(input()) B = list(input()) print(replace(A,B))