#include <string>
#include <iostream>
using namespace std;
 
using ll = long long;
#define REP(i,n) for(ll i=0; i<(n); ++i)
 
int main(){
	string s,t;
	cin >> s >> t;
 
	ll s_index = 0;
	ll t_index = 0;
	bool finish = true;
	REP(i,s.size()){
		if(i%2==0){
			for(;s_index < s.size(); ++s_index){
				if(s[s_index] == s[i]) break;
			}
			if(s_index == s.size()) finish = false;
			else ++s_index;
		}else{
			for(;t_index < t.size(); ++t_index){
				if(t[t_index] == s[i]) break;
			}
			if(t_index == t.size()) finish = false;
			else ++t_index;
		}
	}
	if(finish){
		cout << "Yes" << endl;
		return 0;
	}
 
 
	s_index = 0;
	t_index = 0;
	finish = true;
	REP(i,s.size()){
		if(i%2==1){
			for(;s_index < s.size(); ++s_index){
				if(s[s_index] == s[i]) break;
			}
			if(s_index == s.size()) finish = false;
			else ++s_index;
		}else{
			for(;t_index < t.size(); ++t_index){
				if(t[t_index] == s[i]) break;
			}
			if(t_index == t.size()) finish = false;
			else ++t_index;
		}
	}
	if(finish){
		cout << "Yes" << endl;
	}else{
		cout << "No" << endl;
	}
}