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