#include <bits/stdc++.h>
using namespace std;
string a, b;
vector<int> S[30];
int ans[200050];
void solution() {
  cin >> a >> b;
  for (int i = (0); i < (b.size()); i++) S[b[i] - 'a'].push_back(i);
  if (a[0] != b[0]) {
    cout << "No" << '\n';
    return;
  }
  int mx = 1;
  int max_pos = 1;
  ans[0] = 0;
  for (int i = (1); i < (a.size()); i++) {
    char t = a[i] - 'a';
    if (!S[t].size()) {
      cout << "No" << '\n';
      return;
    }
    vector<int>::iterator it = upper_bound(S[t].begin(), S[t].end(), mx);
    if (it == S[t].end()) --it;
    while (it != S[t].begin()) {
      --it;
      if (*it < mx) {
        ++it;
        if (*it > max_pos) --it;
        break;
      }
    }
    int x = *it;
    ans[i] = x;
    if (mx >= x) mx = x + 1;
    if (x > max_pos) {
      cout << "No" << '\n';
      return;
    }
    it = upper_bound(S[t].begin(), S[t].end(), max_pos);
    if (it == S[t].end()) --it;
    while (it != S[t].begin()) {
      --it;
      if (*it < max_pos) {
        ++it;
        break;
      }
    }
    x = *it;
    if (max_pos == x)
      max_pos++;
    else
      max_pos = (((max_pos) < (mx)) ? (mx) : (max_pos));
  }
  int sz = a.size();
  mx = ans[sz - 1];
  if (mx + 1 != b.size()) {
    cout << "No" << '\n';
    return;
  }
  for (int i = (sz - 2); i >= (0); i--) {
    if (ans[i] == mx - 1)
      mx--;
    else if (ans[i] < mx - 1) {
      cout << "No" << '\n';
      return;
    }
  }
  cout << "Yes" << '\n';
}
int main() { solution(); }
