function Main(input){
  input = input.split("\n");
  const S = input[0].split("");
  const T = input[1].split("");
  
  const L = S.length
  
  for( let i = 0; i <= L - 1; i++ ){
  	if ( S[i] !== T[i] && i < L - 1 ){
    	console.log("No");
        i = L ;
    }else if(i === L - 1){
    	 console.log("Yes");
    }
  }
}
 
Main(require("fs").readFileSync("/dev/stdin", "utf8"));