#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,sse4,popcnt,abm,avx,mmx,tune=native")
const int N = 125050;
char s[N], t[N];
int p[6];
void Init() {
  for (int i = 0; i < 6; i++) p[i] = i;
}
int Find(int x) { return x == p[x] ? x : p[x] = Find(p[x]); }
void Union(int x, int y) { p[Find(x)] = Find(y); }
bool was[6][6];
int main() {
  int n, m, i, j, k;
  scanf("%s", s + 1);
  n = strlen(s + 1);
  for (i = 1; i <= n; i++) s[i] -= 'a';
  scanf("%s", t + 1);
  m = strlen(t + 1);
  for (i = 1; i <= m; i++) t[i] -= 'a';
  for (i = 1; i <= n - m + 1; i++) {
    for (j = 0; j < 6; j++)
      for (k = 0; k < 6; k++) was[j][k] = 0;
    for (j = 1; j <= m; j++) was[s[i + j - 1]][t[j]] = 1;
    int ans = 0;
    Init();
    for (j = 0; j < 6; j++)
      for (k = 0; k < 6; k++)
        if (was[j][k] && Find(j) != Find(k)) ans++, Union(j, k);
    printf("%i ", ans);
  }
  printf("\n");
  return 0;
}
