prog to implement the KNUTH-MORRIS-PRATT algorithm for string matching