#include<bits/stdc++.h>
#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
#define vi vector<ll>
#define vvi vector<vi>
#define BITLE(n) (1LL<<((ll)n))
#define SHIFT_LEFT(n) (1LL<<((ll)n))
#define SUBS(s,f,t) ((s).substr((f)-1,(t)-(f)+1))
#define ALL(a) (a).begin(),(a).end()
#define EPS 1e-15
using namespace std;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  string s,t;cin>>s>>t;
  ll n = s.size();
  bool fl = true;
  ll now = 0;
  t+='A';
  for(int i=0;i<n;i+=2){
    bool can = false;
    while(now < n){
      if(t[now] == s[i]){
	can = true;
	now++;
	break;
      }
      now++;
    }
    if(t[now] == 'A' && can == false){
      fl = false;
    }
  }
  now = 0;
  //t+='A';
  bool fl2=  true;
  for(int i=1;i<n;i+=2){
    bool can = false;
    while(now < n){
      if(t[now] == s[i]){
	can = true;
	now++;
	break;
      }
      now++;
    }
    if(t[now] == 'A' && can == false){
      fl2 = false;
    }
  }
  if(fl||fl2)cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
  return 0;
}

