a,b = sorted(input()),sorte(input()) print("YES" if a==b else "NO")