#include <cstdio>
#include <cstdint>
#include <algorithm>
#include <string>
#include <queue>

bool f(const std::string& s, const std::string &s0, const std::string& t0) {
  std::queue<char> st[2];

  for (char c: s0) st[0].push(c);
  for (char c: t0) st[1].push(c);

  for (size_t i=0; i<s.length(); ++i) {
    size_t j=i%2;
    while (!st[j].empty() && st[j].front() != s[i]) {
      char t=st[j].front();
      // fprintf(stderr, "pop: %c\n", t);
      st[j].pop();
    }
    if (st[j].empty()) return false;
    // fprintf(stderr, "match: %c\n", st[j].front());
    st[j].pop();
  }
  return true;
}

int main() {
  char buf[1024];
  scanf("%s", buf);
  std::string s=buf;
  scanf("%s", buf);
  std::string t=buf;

  if (f(s, s, t) || f(s, t, s)) {
    puts("Yes");
  } else {
    puts("No");
  }
}

