s = sorted(raw_input()) t = sorted(raw_input()) if s == t: print 'YES' else: print 'NO'