A,B = raw_input(),raw_input() counter_A,counter_B = {},{} for c in A: if not c in counter_A: counter_A[c] = 1 else: counter_A[c] += 1 for c in B: if not c in counter_B: counter_B[c] = 1 else: counter_B[c] += 1 if counter_A == counter_B: print 'YES' else: print 'NO'