#include <bits/stdc++.h>
using namespace std;
bool chk(string a, string b, int s) {
  int i;
  char buf;
  for (i = s; i < a.size(); i += 2) {
    buf = a[i];
    auto idx = find(b.begin(), b.end(), buf);
    if ((*idx) == buf) {
      *idx = '.';
    } else {
      return false;
    }
  }
  return true;
}
int main() {
  bool c;
  string a, b;
  cin >> a;
  cin >> b;
  c = chk(a, b, 0);
  if (!c) {
    c = chk(a, b, 1);
  }
  if (c) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}
