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