a = list(map(str,input()))
b = list(map(str,input()))
a.sort()
b.sort()
print('YES' if a == b else 'NO')