a = list(input())
a.sort()
b = list(input())
b.sort()
if a == b:
    print("YES")
else:
    print("NO")