def check(A,B): l={} for i in xrange(len(A)): if A[i] not in l: l[A[i]] = 0 l[A[i]] += 1 for i in xrange(len(B)): if B[i] not in l: print "NO" return l[B[i]] -= 1 if l[B[i]] == 0: del l[B[i]] if len(l)==0: print "YES" else: print "NO" A=raw_input() B=raw_input() l={} check(A,B)