a,b = [input() for _ in '11']
for i in a:
	if a.count(i) != b.count(i):
		print('NO')
		exit()
print('YES')