#include <bits/stdc++.h>
using namespace std;
using llt = long long;
using llf = long double;
using ull = unsigned long long;
#define endl '\n'
#ifdef LOCAL
FILE *InFile = freopen("in_out/in.in", "r", stdin), *OutFile = freopen("in_out/out.out", "w", stdout);
#elif !defined(PAI)
FILE *InFile = stdin, *OutFile = stdout;
#endif
const int N = 2e6 + 3, Bs = 2333;
char s[N], t[N];
int n, ans[N];
ull PBs[N];
class Hash{
private:
ull hs[N];
public:
void In(char *s, int l = strlen(s)){
for(int i = 0; i < l; ++i) hs[i + 1] = hs[i] * Bs + s[i];
}
ull operator()(int l, int r){
return hs[r] - hs[l - 1] * PBs[r - l + 1];
}
} hs;
int main(){
ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
PBs[0] = 1; for(int i = 1; i <= N - 3; ++i) PBs[i] = PBs[i - 1] * Bs;
cin >> s + 1 >> t + 1; n = strlen(s + 1);
hs.In(s + 1, n); int bd;
for(int i = n - 1; i; --i)
if(hs(1, i) == hs(n - i + 1, n)){
bd = i;
break;
}
for(int i = 1; i <= n; ++i)
if(s[i] == t[i])
ans[i] = bd;
for(int i = n - 1; i; --i){
int l = n - i + 1, r = n;
while(l <= r){
int mid = l + r >> 1;
if(hs(i - (n - mid + 1) + 1, i) == hs(mid, n)) r = mid - 1;
else l = mid + 1;
}
ull pre = 0, nxt = 0; l = n - i + 1;
if(l > r) continue;
if(i < r) pre = hs(1, i);
else pre = hs(1, r - 1) * PBs[i - r + 1] + t[r] * PBs[i - r] + hs(r + 1, i);
if(l > r) nxt = hs(l, n);
else nxt = hs(l, r - 1) * PBs[n - r + 1] + t[r] * PBs[n - r] + hs(r + 1, n);
if(pre == nxt) ans[r] = max(ans[r], i);
pre = 0, nxt = 0; r = r - l + 1;
if(i < r) pre = hs(1, i);
else pre = hs(1, r - 1) * PBs[i - r + 1] + t[r] * PBs[i - r] + hs(r + 1, i);
if(l > r) nxt = hs(l, n);
else nxt = hs(l, r - 1) * PBs[n - r + 1] + t[r] * PBs[n - r] + hs(r + 1, n);
if(pre == nxt) ans[r] = max(ans[r], i);
}
int nl = (n + 1) / 2 + 1, nr = n / 2;
for(int i = n / 2; i; --i)
if(hs(1, i) == hs(n - i + 1, n)){
while(nl > i + 1) --nl, ans[nl] = max(ans[nl], i);
while(nr < n - i) ++nr, ans[nr] = max(ans[nr], i);
}
for(int i = 1; i <= n; ++i) cout << ans[i] << endl;
}