#include<bits/stdc++.h>
using namespace std;
int lps[500000];
char str[500000],str1[500000];
int main(){
int x,i,j;
while(scanf("%d",&x)!=EOF){
scanf("%s",str);
scanf("%s",str1);
lps[0]=0;
i=1;
j=0;
while(i<strlen(str)){
if(str[i]==str[j]){
lps[i]=j+1;
i++;
j++;
}
else if(j==0){
lps[i]=0;
i++;
}
else
j=lps[j-1];
}
i=j=0;
while(i<strlen(str1)){
if(str1[i]==str[j]){
i++;
j++;
}
else if(j!=0)
j=lps[j-1];
else
i++;
if(j==strlen(str)){
printf("%d\n",(i-j));
j=lps[j-1];
}
}
printf("\n");
}
return 0;
}
I2luY2x1ZGU8Yml0cy9zdGRjKysuaD4KdXNpbmcgbmFtZXNwYWNlIHN0ZDsKaW50IGxwc1s1MDAwMDBdOwpjaGFyIHN0cls1MDAwMDBdLHN0cjFbNTAwMDAwXTsKaW50IG1haW4oKXsKICAgIGludCB4LGksajsKICAgIHdoaWxlKHNjYW5mKCIlZCIsJngpIT1FT0YpewogICAgICAgIHNjYW5mKCIlcyIsc3RyKTsKICAgICAgICBzY2FuZigiJXMiLHN0cjEpOwogICAgICAgIGxwc1swXT0wOwogICAgICAgIGk9MTsKICAgICAgICBqPTA7CiAgICAgICAgd2hpbGUoaTxzdHJsZW4oc3RyKSl7CiAgICAgICAgICAgIGlmKHN0cltpXT09c3RyW2pdKXsKICAgICAgICAgICAgICAgIGxwc1tpXT1qKzE7CiAgICAgICAgICAgICAgICBpKys7CiAgICAgICAgICAgICAgICBqKys7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZWxzZSBpZihqPT0wKXsKICAgICAgICAgICAgICAgIGxwc1tpXT0wOwogICAgICAgICAgICAgICAgaSsrOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGVsc2UKICAgICAgICAgICAgICAgIGo9bHBzW2otMV07CiAgICAgICAgfQogICAgICAgIGk9aj0wOwogICAgICAgIHdoaWxlKGk8c3RybGVuKHN0cjEpKXsKICAgICAgICAgICAgaWYoc3RyMVtpXT09c3RyW2pdKXsKICAgICAgICAgICAgICAgIGkrKzsKICAgICAgICAgICAgICAgIGorKzsKICAgICAgICAgICAgfQogICAgICAgICAgICBlbHNlIGlmKGohPTApCiAgICAgICAgICAgICAgICBqPWxwc1tqLTFdOwogICAgICAgICAgICBlbHNlCiAgICAgICAgICAgICAgICBpKys7CiAgICAgICAgICAgIGlmKGo9PXN0cmxlbihzdHIpKXsKICAgICAgICAgICAgICAgIHByaW50ZigiJWRcbiIsKGktaikpOwogICAgICAgICAgICAgICAgaj1scHNbai0xXTsKICAgICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBwcmludGYoIlxuIik7CiAgICB9CiAgICByZXR1cm4gMDsKfQo=