A = input() B = input() lA = list(A) lB = list(B) flg = 0 for i in range(len(lA)): if lA.count(lA[i]) != lB.count(lA[i]): flg = 1 break if flg == 1: print("NO") else: print("YES")