class Calc0069
  def initialize(args)
    args = args.map { |l| l.chomp.split(/\s+/) }
    @a = args.shift.first
    @b = args.shift.first
  end

  def calc
    @a.split(//).sort == @b.split(//).sort
  end

  def run
    calc ? 'YES' : 'NO'
  end
end

puts Calc0069.new(STDIN.readlines).run if __FILE__ == $0