#include<iostream>
using namespace std;
char a[100];
int next1[100];
int main(){
int n=12;
for(int i=0;i<n;i++){
cin>>a[i];
}
//然后进行计算next数组
next1[0]=-1;
next1[1]=0;
for(int i=2;i<n;i++){
if(a[i-1]==a[next1[i-1]]){
next1[i]=next1[i-1]+1;
}
else{
//就开始回退
int j=i-1;
while(j>=0&&a[i-1]!=a[next1[j]]){
j=next1[j];
}
if(j==-1)next1[i]=0;
else{
next1[i]=next1[j]+1;
}
}
}
for(int i=0;i<n;i++){
cout<<next1[i]<<" ";
}
return 0;
}