A = list(input()) B = list(input()) A.sort() B.sort() # print(A, B) if A == B: print("YES") else: print("NO")