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

A.sort()
B.sort()

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