A = sorted(input()) B = sorted(input()) # A = sorted('god') # B = sorted('dog') if A == B: print('YES') else: 'NO'