Java solution
\npublic int getMaxRepetitions(String s1, int n1, String s2, int n2) {\n\t\tint count = 0;\n\t\tString primary = "";\n\t\tString secondary = "" ;\n\t\tif(s1.len
```\npublic int getMaxRepetitions(String s1, int n1, String s2, int n2) {\n\t\tint count = 0;\n\t\tString primary = "";\n\t\tString secondary = "" ;\n\t\tif(s1.length()*n1 < s2.length()*n2) {\n\t\t\treturn count;\n\t\t}\n\t\tif(s1.contains(s2)){\n\t\t\tchar[] primArr = s1.toCharArray();\n\t\t\tchar[] secArr = s2.toCharArray();\n\t\t\tint j =0;\n\t\t\tfor(int i=0; i< primArr.length && j<secArr.length; i++) {\n\t\t\t\tif(primArr[i] == secArr[j]) {\n\t\t\t\t\tj++;\n\t\t\t\t}\n\t\t\t\tif(j == secArr.length) {\n\t\t\t\t\tcount +=1;\n\t\t\t\t\tj = 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\tcount = n1* count/n2;\n\t\t\treturn count;\n\t\t}\n\t\tif(s1 == s2) {\n\t\t\tcount = (n1/n2);\n\t\t\treturn count;\n\t\t}\n\t\tfor(int i=1;i <= n1; i++) {\n\t\t\tprimary += s1;\n\t\t}\n\t\tfor(int i=1; i<=n2; i++) {\n\t\t\tsecondary += s2;\n\t\t}\n\t\tchar[] primArr = primary.toCharArray();\n\t\tchar[] secArr = secondary.toCharArray();\n\t\tint j = 0;\n\t\tfor(int i=0; i< primArr.length && j<secArr.length; i++) {\n\t\t\tif(primArr[i] == secArr[j]) {\n\t\t\t\tj++;\n\t\t\t}\n\t\t\tif(j == secArr.length) {\n\t\t\t\tcount +=1;\n\t\t\t\tj = 0;\n\t\t\t}\n\t\t}\n\n\t\treturn count;\n\t}\n\n```
[]