Implemented Knuth-Morris-Pratt algorithm to find longest prefix suffix match.