#include <bits/stdc++.h>
const int N = 2e5 + 5;
int n, m, a[N], b[N], Ans[N], f[N], i[7];
char s[N], t[N];
void KMP(int Cnt) {
  for (int i = 2, j = 0; i <= m; f[i] = j += b[i] == b[j + 1], ++i)
    while (j && b[i] != b[j + 1]) j = f[j];
  for (int i = 1, j = 0; i <= n; ++i) {
    while (j && a[i] != b[j + 1]) j = f[j];
    if ((j += a[i] == b[j + 1]) == m) Ans[i] = std::min(Ans[i], Cnt), j = f[j];
  }
}
int main() {
  scanf("%s%s", s + 1, t + 1), n = strlen(s + 1), m = strlen(t + 1);
  memset(Ans, 0x3f, sizeof Ans), i[5] = 5;
  for (i[0] = 0; i[0] < 6; ++i[0])
    for (i[1] = 1; i[1] < 6; ++i[1])
      for (i[2] = 2; i[2] < 6; ++i[2])
        for (i[3] = 3; i[3] < 6; ++i[3])
          for (i[4] = 4; i[4] < 6; ++i[4]) {
            for (int j = 1; j <= n; ++j) a[j] = i[s[j] - 'a'];
            for (int j = 1; j <= m; ++j) b[j] = i[t[j] - 'a'];
            KMP((i[0] > 0) + (i[1] > 1) + (i[2] > 2) + (i[3] > 3) + (i[4] > 4));
          }
  for (int i = m; i <= n; ++i) printf("%d%c", Ans[i], i == n ? '\n' : ' ');
  return 0;
}
