#include <bits/stdc++.h>
using namespace std;
string str;
bool check(string s, string t) {
  int idx = 0, x = 0;
  while (1) {
    while (x < s.size() && str[idx] != s[x]) x++;
    if (str[idx] != s[x]) return false;
    idx++;
    if (idx == str.size()) break;
    while (x < t.size() && str[idx] != t[x]) x++;
    if (str[idx] != t[x]) return false;
    idx++;
    if (idx == str.size()) break;
  }
  return true;
}
int main() {
  string s, t;
  cin >> s >> t;
  str = s;
  if (check(s, t) || check(t, s))
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return 0;
}
