inputs = STDIN.readlines.map(&:chomp) a = inputs[0] b = inputs[1] def match?(a, b) a.split(//).sort == b.split(//).sort end puts match?(a, b) ? 'YES' : 'NO'