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