Simple Python solution
Code\n\nclass Solution:\n    def getMaxRepetitions(self, s1: str, n1: int, s2: str, n2: int) -> int:\n        l1, l2 = len(s1), len(s2)\n        visited = {}\n 
# Code\n```\nclass Solution:\n    def getMaxRepetitions(self, s1: str, n1: int, s2: str, n2: int) -> int:\n        l1, l2 = len(s1), len(s2)\n        visited = {}\n        index = repeat_count = i = 0\n        while i < n1:\n            print(i)\n            for j in range(l1):\n                if s1[j] == s2[index]:\n                    index += 1\n                if index == l2:\n                    index = 0\n                    repeat_count += 1\n            if index in visited:\n                prev_i, prev_repeat_count = visited[index]\n                r = (n1-1-i) // (i-prev_i)\n                i += (i-prev_i)*r\n                repeat_count += (repeat_count-prev_repeat_count )*r\n                visited = {}\n            else:\n                visited[index] = [i, repeat_count]\n            i += 1\n        return repeat_count // n2\n```
['Python3']