#include <bits/stdc++.h>
using namespace std;
const long long inf = 1e9;
const long long mod = 1e9 + 7;
long long LCS(string s, string t) {
  long long n = s.size();
  long long m = t.size();
  s = "#" + s;
  t = "#" + t;
  vector<vector<long long> > dp(n + 1, vector<long long>(m + 1));
  dp[0][0] = 0;
  for (long long i = (1); i < (n + 1); i++) {
    for (long long j = (1); j < (m + 1); j++) {
      if (s[i] == t[j]) {
        dp[i][j] = max(dp[i][j], dp[i - 1][j - 1] + 1);
      }
      dp[i][j] = max(dp[i][j], dp[i][j - 1]);
      dp[i][j] = max(dp[i][j], dp[i - 1][j]);
    }
  }
  return dp[n][m];
}
signed main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  string s, t;
  cin >> s >> t;
  cout << (LCS(s, t) >= (long long)s.size() / 2 ? "Yes" : "No") << endl;
}
