import collections A = input() B = input() a = collections.Counter(A) b = collections.Counter(B) print('YES' if a == b else 'NO')