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