A=input()
B=input()
C=[c for c in A]
C.sort()
D=[c for c in B]
D.sort()
if C==D:
    print("YES")
else:
    print("NO")