String matching is the problem of finding all occurrences of a string pattern of length in a text of lenght , where . The characters in the pattern and the text come from a finite set called the .
We say that pattern occurs with shift in text if and . If occurs with shift in , then is called a for in , otherwise is called an for in .
In other words, the string-matching problem is to find all valid shifts for in , i.e. the shift set of in . Using the terminology below, the string-matching problem is to , where and is the prefix of of length .
-
: the set of all finite-length strings over
-
: the empty string, i.e. the string of length
-
: the length of string
-
: the concatenation of strings and , with
-
: the q-character prefix of string , i.e.
-
: string is a of string , i.e. for some string
-
: string is a of string , i.e. for some string
-
: is a proper prefix of
-
: is a proper suffix of