#include <bits/stdc++.h>
using namespace std;
string s, t;
int n;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> s >> t;
  n = s.size();
  string u, v;
  for (int i = 0; i < n; ++i) {
    if (i % 2 == 0)
      u += s[i];
    else
      u += t[i];
  }
  for (int i = 0; i < n; ++i) {
    if (i % 2 != 0)
      v += s[i];
    else
      v += t[i];
  }
  if (s == u || s == v)
    cout << "Yes\n";
  else
    cout << "No\n";
}
