#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
#include <cstring>
using namespace std;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define CLR(mat) memset(mat, 0, sizeof(mat))
typedef long long ll;
bool solve(string a, string b, string c) {
  int n = a.length();
  // 024...
  int j = 0;
  int cnt = 0;
  for(int i = 0; i < n; i += 2) {
    while(j < n && b[j] != a[i]) j++;
    if(b[j] == a[i]) cnt++;
    j++;
  }
  if(cnt != (n + 1) / 2) return false;
  
  j = 0;
  cnt = 0;
  for(int i = 1; i < n; i += 2) {
    while(j < n && c[j] != a[i]) j++;
    if(c[j] == a[i]) cnt++;
    j++;
  }
  if(cnt != n / 2) return false;
  return true;
}
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  string s, t;
  cin >> s >> t;
  if(solve(s,s,t) || solve(s,t,s)) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}