3
int getMaxRepetitions(string s1, int n1, string s2, int n2) {4
vector<int> countr(s2.size(), -1), indexr(s2.size(), -1);7
for (int i = 0, j2 = 0; i < n1; i++) {9
int repC = count - countr[j2];10
int repN = i - indexr[j2];11
int remainingN = n1 - i;12
// the times that the pattern repeated13
count += remainingN / repN * repC;14
// the residue at the end of str1, but still might form valid s215
int j2_ = seqIndex[indexr[j2] + remainingN % repN];16
count += countr[j2_] - countr[j2];21
seqIndex.push_back(j2);24
for (int j1 = 0; j1 < s1.size(); j1++) {25
if (s1[j1] == s2[j2]) {27
if (j2 == s2.size()) {