#include <bits/stdc++.h>   using namespace std;   const int M = 2e6 + 10;   int a[M], b[M], c[M], d[M], e[M], f[M];   vector<int> T[M];   struct NTT {     static const int G = 3, P = 998244353;     int N, na, nb, w[2][M], rev[M];     long long kpow(long long a, int b) {       long long c = 1;       for (; b; b >>= 1, a = a * a % P)         if (b & 1) c = c * a % P;       return c;     }     void FFT(int *a, int f) {       for (int i = (0); i < (N); i++)         if (i < rev[i]) swap(a[i], a[rev[i]]);       for (int i = 1; i < N; i <<= 1)         for (int j = 0, t = N / (i << 1); j < N; j += i << 1)           for (int k = 0, l = 0, x, y; k < i; k++, l += t)             x = (long long)w[f][l] * a[j + k + i] % P, y = a[j + k],             a[j + k] = (y + x) % P, a[j + k + i] = (y - x + P) % P;       if (f)         for (int i = 0, x = kpow(N, P - 2); i < N; i++)           a[i] = (long long)a[i] * x % P;     }     void work() {       int d = __builtin_ctz(N);       w[0][0] = w[1][0] = 1;       for (int i = 1, x = kpow(G, (P - 1) / N), y = kpow(x, P - 2); i < N; i++) {         rev[i] = (rev[i >> 1] >> 1) | ((i & 1) << (d - 1));         w[0][i] = (long long)x * w[0][i - 1] % P,         w[1][i] = (long long)y * w[1][i - 1] % P;       }     }     void doit(int *a, int *b, int na, int nb) {       for (N = 1; N < na + nb - 1; N <<= 1)         ;       for (int i = (na); i < (N); i++) a[i] = 0;       for (int i = (nb); i < (N); i++) b[i] = 0;       work(), FFT(a, 0), FFT(b, 0);       for (int i = (0); i < (N); i++) a[i] = (long long)a[i] * b[i] % P;       FFT(a, 1);     }     void get_inv(int *a, int *b, int na) {       if (na == 1) {         b[0] = kpow(a[0], P - 2);         return;       }       get_inv(a, b, (na + 1) >> 1);       for (N = 1; N < (na << 1); N <<= 1)         ;       work();       for (int i = (0); i < (na); i++) c[i] = a[i];       for (int i = (na); i < (N); i++) c[i] = 0;       FFT(c, 0), FFT(b, 0);       for (int i = (0); i < (N); i++)         b[i] = 1ll * (2 - 1ll * c[i] * b[i] % P + P) % P * b[i] % P;       FFT(b, 1);       for (int i = (na); i < (N); i++) b[i] = 0;     }     void get_ln(int *a, int *b, int na) {       for (int i = (0); i < (na - 1); i++)         d[i] = (long long)(a[i + 1]) * (i + 1) % P;       for (int i = (na); i < (N); i++) d[i] = 0;       d[na - 1] = 0;       get_inv(a, b, na);       doit(b, d, na, na);       for (int i = (na)-1; i >= (1); i--)         b[i] = (long long)b[i - 1] * kpow(i, P - 2) % P;       b[0] = 0;     }     void get_exp(int *a, int *b, int na) {       if (na == 1) {         b[0] = 1;         return;       }       get_exp(a, b, (na + 1) >> 1);       for (int i = 0; i < (na << 1); i++) f[i] = 0;       get_ln(b, f, na);       for (N = 1; N < (na << 1); N <<= 1)         ;       work();       f[0] = ((long long)a[0] + 1 - f[0] + P) % P;       for (int i = (1); i < (na); i++) f[i] = ((long long)a[i] - f[i] + P) % P;       FFT(f, 0);       FFT(b, 0);       for (int i = (0); i < (N); i++) b[i] = (long long)b[i] * f[i] % P;       FFT(b, 1);       for (int i = (na); i < (N); i++) b[i] = f[i] = 0;     }     void get_pow(int *a, int *b, int na, int k) {       get_ln(a, e, na);       for (int i = (0); i < (na); i++) e[i] = (long long)e[i] * k % P;       get_exp(e, b, na);     }     void fast_pow(int *a, int *b, int na, int k, int maxn) {       for (N = 1; N < max(((maxn + 1) << 1), (na << 1)); N <<= 1)         ;       for (int i = (na); i < (N); i++) a[i] = 0;       for (int i = (0); i < (N); i++) b[i] = 0;       b[0] = 1;       work();       while (k) {         FFT(a, 0);         if (k & 1) {           FFT(b, 0);           for (int i = (0); i < (N); i++) b[i] = (long long)a[i] * b[i] % P;           FFT(b, 1);           for (int i = (max(na, maxn + 1)); i < (N); i++) b[i] = 0;         }         for (int i = (0); i < (N); i++) a[i] = (long long)a[i] * a[i] % P;         FFT(a, 1);         for (int i = (max(na, maxn + 1)); i < (N); i++) a[i] = 0;         k >>= 1;       }     }     priority_queue<pair<int, int> > H;     void Merge(int m) {       while (!H.empty()) H.pop();       for (int i = (1); i < (m + 1); i++) H.emplace(make_pair(-T[i].size(), i));       while (H.size() >= 2) {         int x = H.top().second;         H.pop();         int y = H.top().second;         H.pop();         for (int i = (0); i < (T[x].size()); i++) a[i] = T[x][i];         for (int i = (0); i < (T[y].size()); i++) b[i] = T[y][i];         doit(a, b, T[x].size(), T[y].size());         int na = T[x].size() + T[y].size();         T[x].clear();         T[y].clear();         for (int i = (0); i < (na); i++) T[x].push_back(a[i]);         H.emplace(-T[x].size(), x);       }     }   } ntt;   int F[10];   int dis[300000 + 10][7][7];   int find(int i) {     if (F[i] == i) return i;     return F[i] = find(F[i]);   }   int main() {     string s, t;     cin >> s >> t;     int n = s.size(), m = t.size();     reverse(t.begin(), t.end());     for (int i = (0); i < (6); i++) {       for (int j = (0); j < (6); j++) {         if (i == j) continue;         for (int k = (0); k < (n); k++) {           if (s[k] == i +  a )             a[k] = 1;           else             a[k] = 0;         }         for (int k = (0); k < (m); k++) {           if (t[k] == j +  a )             b[k] = 1;           else             b[k] = 0;         }         ntt.doit(a, b, n, m);         for (int k = (m - 1); k < (n); k++) {           dis[k][i][j] = a[k];         }       }     }     for (int i = (m - 1); i < (n); i++) {       for (int j = (0); j < (6); j++) F[j] = j;       for (int j = (0); j < (6); j++) {         for (int k = (0); k < (6); k++) {           if (j == k) continue;           if (dis[i][j][k]) F[find(j)] = find(k);         }       }       int ans = 0;       for (int j = (0); j < (6); j++) {         if (F[j] == j) ans++;       }       cout << 6 - ans <<    ;     }     return 0;   }