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