function main(arg) {
	arg  = arg.split("\n")
	var s = arg[0]
	var t = arg[1]

	for (var i  = 0; i < t.length; i++) {
		var si = s[i].slice()
		var ti = t[i].slice()
	
		if (si === ti) {
			continue
		}

		if (s.toLowerCase() === t) {
			break
		}

		s = s.replace(si, '1')
		s = s.replace(ti, '2')
		s = s.replace('1', ti)
		s = s.replace('2', si)
	}

	
	if (s.toLowerCase() === t) {
		console.log('Yes')
	} else {
		console.log('No')
	}
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));
