Algorithm for Failure function
FailureFunction(P)
The running time of FailureFunction is O(m) where m is the length of the pattern P.