chars1 = sorted(list(input()))
chars2 = sorted(list(input()))
if chars1 == chars2:
    print("YES")
else:
    print("NO")