X = list(input()) Y = list(input()) X.sort() Y.sort() if X == Y: print('YES') else: print('NO')