a=sorted(input()) b=sorted(input()) count=0 for i in range(0,len(a)): if a==b: count+=1 if count==len(a): print("YES") else: print("NO")