a = gets.chomp b = gets.chomp c = "YES" a.chars { |ch| c = "NO" if a.count(ch) != b.count(ch) } puts c