q0 = list(input()) q1 = list(input()) q0.sort() q1.sort() if q0 == q1: print("YES") else: print("NO")