#include<bits/stdc++.h> using namespace std; #define sd 1000010 int a1,b1,j; int kmp[sd]; char a[sd],b[sd]; int main() { cin>>a+1; cin>>b+1; a1=strlen(a+1); b1=strlen(b+1); for(int i=2;i<=b1;i++) { while(j&&b[i]!=b[j+1]) j=kmp[j]; if(b[j+1]==b[i]) j++; kmp[i]=j; } j=0; for(int i=1;i<=a1;i++) { while(j&&b[j+1]!=a[i]) j=kmp[j]; if(b[j+1]==a[i]) j++; if(j==b1) { cout<<i-b1+1<<endl;j=kmp[j]; } } for (int i=1;i<=b1;i++) cout<<kmp[i]<<" "; }