A=input() B=input() p=[] q=[] for i in A: p.append(i) for i in B: q.append(i) p.sort() q.sort() if p==q: print("YES") else: print("NO")