c++ solution
class Solution {\npublic:\n    int getMaxRepetitions(string s1, int n1, string s2, int n2) {\n        int n = s1.size(),m = s2.size();\n        int matchLen[n][
class Solution {\npublic:\n    int getMaxRepetitions(string s1, int n1, string s2, int n2) {\n        int n = s1.size(),m = s2.size();\n        int matchLen[n][m];\n        int matchInd[n][m];\n        for(int i = 0;i<n;i++){\n            for(int j = 0;j<m;j++){\n                int ind = i,lstInd = -1,cnt = 0;\n                for(int k = j;k<m && ind<n;k++){\n                    while(ind<n && s2[k]!=s1[ind]) ind++;\n                    if(ind<n){\n                        cnt++;\n                        lstInd = ind;\n                        ind++;\n                    }\n                    else break;\n                }\n                matchLen[i][j] = cnt;\n                matchInd[i][j] = lstInd;\n            }\n        }\n        int cnts1 = 1,cnts2 = 1;\n        int dones2 = 0;\n        int inds1 = 0,inds2 = 0;\n        while(cnts1<=n1){\n            int l = matchLen[inds1][inds2];\n            if(l == 0){\n                cnts1++;\n                inds1 = 0;\n                continue;\n            }\n            int newInds1 = matchInd[inds1][inds2];\n            int need = m-inds2;\n            if(l<need){\n                inds2+=l;\n                cnts1++;\n                inds1 = 0;\n            }\n            else{\n                dones2++;\n                inds1 = matchInd[inds1][inds2];\n                inds2 = 0;\n                if(inds1 == n-1) {\n                    cnts1++; \n                    inds1 = 0;\n                }\n                else inds1++;\n            }\n        }\n        return dones2/n2;\n    }\n};\n```
['C++']