#include <bits/stdc++.h>
using namespace std;
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) {
        if (a[pos] == a[i]) {
          tmp.push_back(a[i]);
          pos++;
          f = !f;
        }
        i++;
      } else {
        if (a[pos] == b[j]) {
          tmp.push_back(b[j]);
          pos++;
          f = !f;
        }
        j++;
      }
      if (i >= as || j >= bs) break;
      if (tmp.size() == as) break;
    }
    if (tmp == a) ok = 1;
  }
  if (ok)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return 0;
}
