A = list(input()); B = list(input()); if sorted(A) == sorted(B): print('YES') else: print('NO')