a = input() b = input() a.sort() b.sort() if a==b: print("YES") else: print("NO")