A = input() B = input() n = len(A) # A、Bをリストに A_list = [A[i] for i in range(n)] B_list = [B[i] for i in range(n)] A_list.sort() B_list.sort() if A_list == B_list: print('Yes') else: print('No')