A = input() B = input() original_string = A sorted_string = sorted(original_string) X=(sorted_string) original_string2 = B sorted_string2 = sorted(original_string) Y=(sorted_string2) if X == Y: print('YES') else: print('NO')