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

string s, t;

bool check(int dir) {
	int i = 0;
	int j = 0;
	int len = 0;
	
	while (len < s.length()) {
		char key = s[len];
		if (dir == 0) {
			for (; i < s.length() && s[i] != key; i++);
			if (i == s.length()) return false;
			i++;
		}
		else {
			for (; j < t.length() && t[j] != key; j++);
			if (j == t.length()) return false;
			j++;
		}
		len++;
		dir = !dir;
	}
	return true;
}

int main() {
	cin >> s >> t;
	if (check(0) || check(1)) { cout << "Yes" << endl; }
	else { cout << "No" << endl; }
	return 0;
}