import collections a = input() b = input() a_list = list(a) b_list = list(b) a_counter = collections.Counter(a_list) b_counter = collections.Counter(b_list) if a_counter == b_counter: print('YES') else: print('No')