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