for int len int i-1 while true if break else

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
for(int i = 2;i<len+1;i++){
int l =p[i-1];
while(true){
if(a[i] == a[l+1]){
p[i] = l+1;
break;
}else{
l = p[l];
}
}