A = list(input()) B = list(input()) A.sort() B.sort() for a, b in zip(A, B): if a!=b: print("NO") exit() print("YES")