#include<iostream>
using namespace std;
const int N = 1e6 + 10;
char s1[N],s2[N];
int ne[N];
int temp;
int main(){
cin>>s1+1>>s2+1;
for(int i = 2,j = 0;s2[i] != '\0';i++){
while(j && s2[i] != s2[j+1]){
j = ne[j];
}
if(s2[i] == s2[j+1]){
j++;
}
ne[i] = j;
}
for(int i = 1,j = 0;s1[i] != '\0';i++){
while(j && s1[i] != s2[j+1]){
j = ne[j];
}
if(s1[i] == s2[j+1]){
j++;
}
if(s2[j+1] == '\0'){
cout<<i-j+1<<endl;
temp = j;
j = 0;
}
}
for(int k = 1;k <= temp;k++){
cout<<ne[k]<<" ";
}
return 0;
}