A, B = [str(input()) for i in range(2)] A_sort = sorted(A) B_sort = sorted(B) if A_sort == B_sort: print("YES") else: print("NO")