a,b=str(input()),str(input()) a=[*a] b=[*b] a.sort() b.sort() if a==b: print("YES") else: print("NO")