#include <bits/stdc++.h>
using namespace std;
using ui = unsigned;
using ll = long long;
using ul = unsigned long long;
using ld = long double;
const int inf = 1e9 + 10;
const ll inf_ll = 1e18 + 10;
const ll mod = 1e9 + 7;
const ll mod9 = 1e9 + 9;
const int dx[]{-1, 0, 1, 0, -1, 1, 1, -1};
const int dy[]{0, -1, 0, 1, -1, -1, 1, 1};
template <class T, class U>
void chmin(T &x, const U &y) {
  x = min<T>(x, y);
}
template <class T, class U>
void chmax(T &x, const U &y) {
  x = max<T>(x, y);
}
struct prepare_ {
  prepare_() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(12);
  }
} prepare__;
string s, t;
int dp[1010][1010];
int main() {
  cin >> s >> t;
  fill_n(*dp, 1010 * 1010, -inf);
  dp[0][0] = 0;
  for (ll i = (0); i < (ll)(s.size() + 1); i += (ll)(1))
    for (ll j = (0); j < (ll)(t.size() + 1); j += (ll)(1)) {
      chmax(dp[i + 1][j], dp[i][j]);
      chmax(dp[i][j + 1], dp[i][j]);
      if (s[i] == t[j]) chmax(dp[i + 1][j + 1], dp[i][j] + 1);
    }
  cout << (dp[s.size()][t.size()] >= s.size() / 2 ? "Yes\n" : "No\n");
}
