#No.69 文字を自由に並び替え A = input() B = input() S = [chr(i) for i in range(97,97+26)] #小文字英字のリスト p = 0 for n in S: m = A.count(n) n = B.count(n) if m == n: p = p + 1 else: print('NO') break if p == 26: print('YES')