def _generate_overlap_table(prefix):
 table = ([0] * len(prefix))
 for i in range(1, len(prefix)):
  idx = table[(i - 1)]
  while (prefix[i] != prefix[idx]):
   if (idx == 0):
    table[i] = 0
    break
   idx = table[(idx - 1)]
  else:
   table[i] = (idx + 1)
 return table

def _generate_overlap_table ( prefix ) : table = ( [ 0 ] * len ( prefix ) ) for i in range ( 1 , len ( prefix ) ) : idx = table [ ( i - 1 ) ] while ( prefix [ i ] != prefix [ idx ] ) : if ( idx == 0 ) : table [ i ] = 0 break idx = table [ ( idx - 1 ) ] else : table [ i ] = ( idx + 1 ) return table
generate an overlap table for the following prefix .