Simple C++ code, 16 lines, but slow, 179ms
\nclass Solution {\npublic:\n    int getMaxRepetitions(string s1, int n1, string s2, int n2) {\n        int len=s2.size();\n        vector<int> dp(len);\n      
```\nclass Solution {\npublic:\n    int getMaxRepetitions(string s1, int n1, string s2, int n2) {\n        int len=s2.size();\n        vector<int> dp(len);\n        for(int i=0;i<len;i++){\n            int start=i;\n            for(char ch : s1)if(ch==s2[start%len])start++;\n            if(start==i)return 0;\n            dp[i]=start-i;\n        }\n        int idx=0;\n        for(int i=0;i<n1;i++)idx+=dp[idx%len];\n        return idx/len/n2;\n    }\n};\n```
[]