#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cstring>
using namespace std;
const int MAXL=1000000;
char s1[MAXL+10],s2[MAXL+10];
int len1,len2;
int nxt[MAXL+10];
int main()
{
scanf("%s%s",s1+1,s2+1);
len1=strlen(s1+1);len2=strlen(s2+1);
for(int i=2;i<=len2;++i)
{
int j=nxt[i-1];
while(j&&s2[j+1]!=s2[i])j=nxt[j];
nxt[i]=((s2[j+1]==s2[i])?(j+1):0);
}
int now=0;
for(int i=1;i<=len1;++i)
{
if(s1[i]==s2[now+1])++now;
else
{
while(now&&s1[i]!=s2[now+1])now=nxt[now];
now+=(s1[i]==s2[now+1]);
}
if(now==len2)printf("%d
",i-len2+1);
}
for(int i=1;i<=len2;++i)printf("%d ",nxt[i]);
return 0;
}