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