#include <bits/stdc++.h>
using namespace std;
string a, b, c, d;
int ans[150005], kmp[150005], bel[10], n, m, M;
inline void cal() {
  for (int i = 1; i <= n; i++) c[i] = bel[a[i] - 'a' + 1] + 'a';
  for (int i = 1; i <= m; i++) d[i] = bel[b[i] - 'a' + 1] + 'a';
  int now = 0;
  for (int i = 2; i <= m; i++) {
    while (now && d[i] != d[now + 1]) now = kmp[now];
    if (d[now + 1] == d[i]) ++now;
    kmp[i] = now;
  }
  now = 0;
  for (int i = 1; i <= n; i++) {
    while (now && c[i] != d[now + 1]) now = kmp[now];
    if (c[i] == d[now + 1]) ++now;
    if (now == m) {
      now = kmp[now];
      ans[i - m + 1] = min(ans[i - m + 1], 6 - M);
    }
  }
}
inline void dfs(int now, int mx) {
  if (now == 7) {
    M = mx;
    cal();
    return;
  }
  for (int i = 1; i <= mx + 1; i++) {
    bel[now] = i;
    dfs(now + 1, max(mx, i));
  }
}
int main(int argc, char** argv) {
  cin >> a >> b;
  n = a.size(), m = b.size();
  a = ' ' + a, b = ' ' + b;
  c = a, d = b;
  for (int i = 1; i <= n - m + 1; i++) ans[i] = 10;
  dfs(1, 0);
  for (int i = 1; i <= n - m + 1; i++) cout << ans[i] << " ";
  return 0;
}
