a = raw_input() b = raw_input() if sorted(a) == sorted(b): print "YES" else: print "NO"