word_a = input() word_b = input() result = 'YES' for a in word_a: if word_a.count(a) != word_b.count(a): result = 'NO' break print(result)