This documentation is automatically generated by online-judge-tools/verification-helper
#include "string/kmp.hpp"#pragma once
#include <common.hpp>
vector<int> kmp(string s) {
int n = s.size();
vector<int> f(n + 1);
for (int i = 1, j = 0; i < n; i++) {
while (j && s[i] != s[j]) {
j = f[j];
}
j += (s[i] == s[j]);
f[i + 1] = j;
}
return f;
}