A = str(input()) B = str(input()) sort_A = sorted(A) sort_B = sorted(B) if(sort_A == sort_B): print('YES') else: print('NO')