#include<bits/stdc++.h>
using namespace std;

#define int long long
#define pb push_back 
#define pf push_front 
#define mp make_pair
#define fr first
#define sc second
#define Rep(i, n) for ( int i = 0 ; i < (n); i++ )
#define All(v) v.begin(), v.end()

typedef pair<int, int> Pii; typedef pair<int, Pii> Pip;
const int INF = 1107110711071107;


signed main() {
  string S, T;
  cin >> S >> T;

  bool flag = true;
  int s = 0, t = 0, p = 0;;
  while ( 1 ) {
    if ( p == S.size() ) break;
    if ( flag ) {
      if ( s == S.size() ) break;
      while ( 1 ) {
	if ( S[s] == S[p] ) {
	  s++; p++;
	  break;
	}
	s++;
	if ( s == S.size() ) break;
      }
      flag = false;
    } else {
      if ( t == T.size() ) break;
      while ( 1 ) {
	if ( T[t] == S[p] ) {
	  t++; p++;
	  break;
	}
	t++;
	if ( t == T.size() ) break;
      }
      flag = true;
    }
  }

  if ( p == S.size() ) {
    cout << "Yes" << endl;
    return 0;
  }

  
  flag = false;
  s = 0; t = 0; p = 0;;
  while ( 1 ) {
    if ( p == S.size() ) break;
    if ( flag ) {
      if ( s == S.size() ) break;
      while ( 1 ) {
	if ( S[s] == S[p] ) {
	  s++; p++;
	  break;
	}
	s++;
	if ( s == S.size() ) break;
      }
      flag = false;
    } else {
      if ( t == T.size() ) break;
      while ( 1 ) {
	if ( T[t] == S[p] ) {
	  t++; p++;
	  break;
	}
	t++;
	if ( t == T.size() ) break;
      }
      flag = true;
    }
  }
  
  if ( p == S.size() ) {
    cout << "Yes" << endl;
    return 0;
  }

  cout << "No" << endl;
  return 0;
}