import sys input=lambda: sys.stdin.readline().rstrip() A=sorted(input()) B=sorted(input()) if A==B: print("YES") else: print("NO")