fun main(args:Array<String>) {
	val s= readLine()!!
	val t= readLine()!!
	val st = mutableMapOf<Char,Char>()
	val ts = mutableMapOf<Char,Char>()
	for(i in 0..s.lastIndex){
		st[s[i]]=t[i]
		ts[t[i]]=s[i]
	}
	
	val ans = (0..s.lastIndex).all{ i->
		st[s[i]]==t[i] && ts[t[i]]==s[i]
	}
	
	println(if(ans)"Yes" else "No")
}