include [HTML_REMOVED]
using namespace std;
string p,s;
int m,n;
vector[HTML_REMOVED] res;
int j,k;
int ne[100004];
void nt(){
ne[0]=-1;
for(int i=2;i<=n;i++){
int q=i-1;
while(ne[q]!=-1&&p[ne[q]]!=p[i-1]) q=ne[q];
if(ne[q]!=-1) ne[i]=ne[q]+1;
else ne[i]=0;
}
}
int main(){
cin>>n>>p>>m>>s;
nt();
while(k<m){
if(j<n&&p[j]==s[k]){
j;k;
}else{
if(j==n) res.push_back(k-j);
j=ne[j];
if(j==-1) {
j=0;k++;
}
}
}
if(j==n) res.push_back(k-j);
for(auto re:res){
cout<<re<<’ ‘;
}
}