#include <iostream>
#include <algorithm>
using namespace std;

string S, T;

int main() {
    cin >> S >> T;

    int s_len = S.size(), t_len = T.size();

    // s0 + t0 + s1 + t1 + ...
    int ind = 0;
    int s_ind = 0, t_ind = 0;

    while (ind < s_len && s_ind < s_len && t_ind < t_len) {
        while (s_ind < s_len && S[s_ind++] != S[ind]);
        if (S[s_ind-1] != S[ind]) { break; }
        ++ind;
        while (t_ind < t_len && T[t_ind++] != S[ind]);
        if (T[t_ind-1] != S[ind]) { break; }
        ++ind;
    }
    if (ind == s_len) {
        cout << "Yes" << endl;
        return 0;
    }

    // t0 + s0 + t1 + s1 + ...
    ind = s_ind = t_ind = 0;
    while (ind < s_len && s_ind < s_len && t_ind < t_len) {
        while (t_ind < t_len && T[t_ind++] != S[ind]);
        if (T[t_ind-1] != S[ind]) { break; }
        ++ind;
        while (s_ind < s_len && S[s_ind++] != S[ind]);
        if (S[s_ind-1] != S[ind]) { break; }
        ++ind;
    }
    cout << (ind == s_len ? "Yes" : "No") << endl;
    return 0;
}