A, B = [input() for i in range(2)] ans = "YES" A = sorted(A) B = sorted(B) for i in range(len(A)): if A[i] != B[i]: ans = "NO" break print(ans)