a,b = 2.times.map { gets.chomp }.map {|v| v.chars.sort.join} puts a == b ? "YES" : "NO"