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