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