A=raw_input() B=raw_input() A_list = list(A) B_list = list(B) A_list.sort() B_list.sort() if(A_list==B_list): print ("YES") else: print ("NO")