A = input() B = input() A_list = list(A) A_list.sort() B_list = list(B) B_list.sort() bad_flag = False for a, b in zip(A_list, B_list): if a != b: bad_flag = True if bad_flag: print("NO") else: print("YES")