A - input() B = input() A_1 = sorted(A) B_1 = sorted(B) if A_1 == B_1: print("YES") else: print("NO")