a = input()
b = input()

a_s = ''.join(sorted(a))
b_s = ''.join(sorted(b))

if a_s == b_s:
    print("YES")
else:
    print("NO")