strpre=[]
straft=[]

strpre=list(input())
straft=list(input())

strpre.sort()
straft.sort()
if strpre==straft:
    print("YES")
else:
    print("NO")