#include <iostream>
#include<cstdlib>
#include<queue>
#include<set>
#include<vector>
#include<string>
#include<algorithm>
#include<sstream>
#include<cmath>
#include<stack>
#include<map>
#include<cstdio>
using namespace std;
#define rep(i,a) for(int i=0;i<a;i++)
#define mp make_pair
#define pb push_back
#define P pair<int,int>
#define ll long long
string a,b;
char t[2000];
int main(){
cin>>a>>b;
int as=a.size(),bs=b.size();
int num=as/2,pos=0;
bool ok=0,ok2;


for(int k=0;k<2;k++){
int i=0,j=0;
string tmp="";
bool f=k;


while(true){
	if(f&&i<as){//aからとる
		if(a[pos]==a[i]){tmp.push_back(a[i]);pos++;f=!f;}
		i++;
	}

	else if(!f&&j<bs){
		if(a[pos]==b[j]){tmp.push_back(b[j]);pos++;f=!f;}
		j++;
	}
	if(i>=asj>=bs)break;
	if(tmp.size()==as)break;
}


//cout<<tmp<<endl;
	if(tmp==a)ok=1;
}
/*
for(int k=0;k<2;k++){
pos=0;
rep(l,2000)t[l]=' ';

for(int i=k;i<as;i+=2){
	//if(i>=bs){t[pos++]='@';}
	 t[pos++]=a[i];
}

rep(j,pos)cout<<t[j]<<" ";cout<<endl;
for(int i=0;i<bs;i++){
	int c=0;
	if(b[i]==t[c]){
		for(int j=i;j<bs;j++){
			if(b[j]==t[c])c++;
		}
		if(c==pos)ok=1;
	}

}
}
*/
//if(abs(as-bs)>1)ok=0;
if(ok)cout<<"Yes"<<endl;
else cout<<"No"<<endl;

	return 0;
}
