A = input() B = input() C = [] D = [] for i in A: C.append(i) for i in B: D.append(i) C.sort() D.sort() if C == D: print("YES") else: print("NO")