| 13 | const int mod = 1e9 + 7; |
| 14 | |
| 15 | vector<int> prefix_function(string &s) { |
| 16 | int n = (int)s.size(); |
| 17 | vector<int> pi(n, 0); |
| 18 | for (int i = 1; i < n; i++) { |
| 19 | int j = pi[i-1]; |
| 20 | while (j > 0 && s[i] != s[j]) j = pi[j-1]; |
| 21 | if (s[i] == s[j]) j++; |
| 22 | pi[i] = j; |
| 23 | } |
| 24 | return pi; |
| 25 | } |
| 26 | int aut[N][26]; |
| 27 | void compute_automaton(string s) |
| 28 | { |
no test coverage detected