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