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