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