A = input() B = input() print("YES" if list(A).sort() == list(B).sort() else "NO")