forked from go/golangs_learn
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
17 lines
374 B
17 lines
374 B
package main
|
|
|
|
import "fmt"
|
|
|
|
/**
|
|
KMP算法中每一次的匹配,
|
|
|
|
1、主串的起始位置 = 上一轮匹配的失配位置;
|
|
2、模式串的起始位置 = 重复字符结构的下一位字符(无重复字符结构,则模式串的首字符)
|
|
*/
|
|
func main() {
|
|
fmt.Println("KMP算法 开始...")
|
|
strA := "ababcabcacbab"
|
|
strB := "abcac"
|
|
fmt.Println(strB, strA)
|
|
|
|
}
|
|
|