Java While loop O(len(S1))
Ref: https://leetcode.com/problems/count-the-repetitions/discuss/95401/Ugly-Java-brute-force-solution-but-accepted.-1088ms.\n\n    public int getMaxRepetitions(
Ref: https://leetcode.com/problems/count-the-repetitions/discuss/95401/Ugly-Java-brute-force-solution-but-accepted.-1088ms.\n```\n    public int getMaxRepetitions(String s1, int n1, String s2, int n2) {\n        char[] a1 = s1.toCharArray(), a2 = s2.toCharArray();\n        int l1 = a1.length, l2 = a2.length, c1 = 0, c2 = 0, i = 0, j = 0;\n        while (c1 < n1) {\n            if (a1[i] == a2[j]) {\n                if (++j == l2) {\n                    j = 0;\n                    c2++;\n                }\n            }\n            if (++i == l1) {\n                i = 0;\n                c1++;\n            }\n        }\n        return c2 / n2;\n    }\n```
[]