KMP Prefix Function
for each position, the longest proper prefix that is also a suffix — the table KMP matches with