#include <bits/stdc++.h>
using namespace std;
string s, t;
int n, m;
vector<pair<int, int> > all[26];
int pos[26];
bool check() {
  for (int i = 0; i < n; i++) {
    int j = s[i] - 'a';
    if (all[j].size() == 0) return false;
    while (pos[j] < all[j].size() && all[j][pos[j]].second < i) pos[j]++;
    if (pos[j] == all[j].size() || all[j][pos[j]].first > i) return false;
  }
  return true;
}
int main() {
  cin >> s >> t;
  n = s.size(), m = t.size();
  int i1, i2;
  vector<int> p1;
  i1 = 0, i2 = 0;
  while (i1 < n && i2 < m) {
    if (s[i1] == t[i2]) {
      p1.push_back(i1);
      i1++, i2++;
    } else {
      i1++;
    }
  }
  if (p1.size() != m || p1[0] != 0) {
    cout << "No" << endl;
    return 0;
  }
  vector<int> p2;
  i1 = n - 1, i2 = m - 1;
  while (i1 >= 0 && i2 >= 0) {
    if (s[i1] == t[i2]) {
      p2.push_back(i1);
      i1--, i2--;
    } else {
      i1--;
    }
  }
  if (p2.size() != m || p2[0] != n - 1) {
    cout << "No" << endl;
    return 0;
  }
  for (int i = 0; i < m; i++) {
    int r1 = p1[i], r2 = p2[m - i - 1];
    all[s[r1] - 'a'].push_back(make_pair(r1, r2));
  }
  if (check())
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}
