A=str(input())
B=str(input())
A=''.join(sorted(A))
B=''.join(sorted(B))
if A==B:
    print("YES")
else:
    print("NO")