A, B = list(input()), list(input())

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