prefix_function
Computes the KMP prefix/failure function array for an input string and optionally counts pattern occurrences to support string matching and failure-link analysis.
Instructions
Compute the KMP prefix/failure function array, with optional pattern occurrence counting.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| text | Yes | Input string (max 1,000,000 chars) | |
| pattern | No | Optional pattern to count occurrences of |