This is the code for brute-force string matching: 以下是蛮力串匹配的代码:
What's the return value when the matching succeeds / fails? 当匹配成功/失败时的返回值分别为:
AThe first occrence of P in T / -1
P在T中首次出现的位置 / -1
BThe first occrence of P in T / a number greater than n - m
P在T中首次出现的位置 / 一个大于n-m的数
CThe last occrence of P in T / a number greater than n - m
P在T中最后一次出现的位置 / 一个大于n-m的数
DThe last occrence of P in T / -1
P在T中最后一次出现的位置 / -1