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