A = input().strip() B = input().strip() if (sorted(A) == sorted(B)): print("YES") else: print("NO")