A border of a word is a word that is both a proper prefix and a proper suffix of (the empty word is always one). The failure function of is , the length of the longest border of , for .
abababc. The matched part ababa has the longest border aba; the pattern moves so that its prefix aba sits under the text’s aba, and the comparison resumes at the same text letter, with .