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