📅  最后修改于: 2022-03-11 14:57:15.649000             🧑  作者: Mango
vector z_function(string s) {
int n = (int) s.length();
vector z(n);
for (int i = 1; i < n; ++i)
while (i + z[i] < n && s[z[i]] == s[i + z[i]])
++z[i];
return z;
}