Изменения
→Псевдокод
<tex>\pi</tex>[1] = 0
k = 0
'''for''' (i = 2; i < '''to''' s.length; k = <tex>\pi</tex>[i++) {-1] '''while''' (k > 0 && s[i] != s[k + 1]) {
k = <tex>\pi</tex>[k]
k++
<tex>\pi</tex>[i] = k
'''return''' <tex>\pi</tex>