A = input() B = input() C = [] D = [] for i in A: if i not in B: print("NO") break else: a = list(A) b = list(B) for i in range(len(A)): for j in range(len(B)): if a[i] == b[j]: a[i]=0 b[j]=0 if a != b: print("NO") else: print("YES")