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