#include <bits/stdc++.h>
using namespace std;
int n, m;
int a[500010], b[500010];
int pre[500010], nex[500010];
char s1[500010], s2[500010];
int solve() {
  int i, j, len1, len2;
  len1 = strlen(s1);
  len2 = strlen(s2);
  int top = -1;
  memset(nex, -1, sizeof(nex));
  for (i = 0; i < len1; i++) {
    if (top < len2 - 1 && s1[i] == s2[top + 1])
      nex[s1[i]] = ++top;
    else if (nex[s1[i]] < 0)
      break;
    a[i] = nex[s1[i]];
  }
  if (i != len1) return 0;
  memset(pre, -1, sizeof(pre));
  top = len2;
  for (i = len1 - 1; i >= 0; i--) {
    if (top > 0 && s2[top - 1] == s1[i])
      pre[s1[i]] = --top;
    else if (pre[s1[i]] < 0)
      break;
    b[i] = pre[s1[i]];
  }
  if (i != -1) return 0;
  for (i = 0; i < len1; i++) {
    if (b[i] <= a[i])
      continue;
    else
      break;
  }
  if (i == len1) return 1;
  return 0;
}
int main() {
  while (scanf("%s %s", s1, s2) != EOF) {
    if (solve())
      puts("Yes");
    else
      puts("No");
  }
}
