#include <bits/stdc++.h>
using namespace std;
int read() {
  int X = 0, w = 1;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') w = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') X = X * 10 + c - '0', c = getchar();
  return X * w;
}
const int N = 125000 + 10;
int n, m;
char s[N], t[N];
int bl[N], ans[N];
int nxt[N];
void getnext() {
  for (int i = 2, j = 0; i <= m; ++i) {
    while (j && bl[t[j + 1]] != bl[t[i]]) j = nxt[j];
    if (bl[t[j + 1]] == bl[t[i]]) ++j;
    nxt[i] = j;
  }
}
void calc(int w) {
  getnext();
  for (int i = 1, j = 0; i <= n; ++i) {
    while (j && bl[t[j + 1]] != bl[s[i]]) j = nxt[j];
    if (bl[t[j + 1]] == bl[s[i]]) ++j;
    if (j == m) ans[i - m + 1] = min(ans[i - m + 1], w);
  }
}
void dfs(char c, int tot) {
  if (c > 'f') {
    calc(6 - tot);
    return;
  }
  for (int i = 1; i <= tot; ++i) bl[c] = i, dfs(c + 1, tot);
  bl[c] = tot + 1, dfs(c + 1, tot + 1);
}
int main() {
  scanf("%s%s", s + 1, t + 1), n = strlen(s + 1), m = strlen(t + 1);
  memset(ans, 0x3f, sizeof(ans));
  dfs('a', 0);
  for (int i = 1; i <= n - m + 1; ++i) printf("%d ", ans[i]);
  puts("");
  return 0;
}
