from collections import Counter A = input() B = input() A_list = [] B_list = [] for c1, c2 in zip(A, B): A_list.append(c1) B_list.append(c2) A = sorted(A_list) B = sorted(B_list) yes_flag = True for c1, c2 in zip(A, B): if c1 != c2: print('NO') yes_flag = False break if yes_flag: print('YES')