function Main(input) {
	input = input.split("\n");
var S=input[0];
var T=input[1];
var l=S.length;
var word;
var count1=0;
var count2=0;

for(var i=0;i<l;i++){
if(S[i].match(/[a-z]/)!=null){
 word = new RegExp(S[i],"g");
 S.replace(word,count1);
 count1++;
}

if(T[i].match(/[a-z]/)!=null){
 word = new RegExp(T[i],"g");
 T.replace(word,count2);
 count2++;
}
}

if(S==T){
 console.log('Yes');
}else{
 console.log('No');
}
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));