A = input() B = input() arrA = [] for a in A: arrA.append(a) arrA.sort() arrB = [] for b in B: arrB.append(b) arrB.sort() if arrA == arrB: print('YES') else: print('NO')