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