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