import math def proc(x,y): x_lst = list(x) x_lst.sort() y_lst = list(y) y_lst.sort() for i in range(len(x_lst)): if x_lst[i] != y_lst[i] : return False else : return True x = input() y = input() if proc(x,y): print('YES') else: print('NO')