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