s = gets.chomp.chars.tally t = gets.chomp.chars.tally puts s == t ? "YES" : "NO"