Description
Given a string sequence and a word, return the maximum k-repeating value where word repeated k times is a substring of sequence.
Examples
Input:
sequence = "ababc", word = "ab"Output:
2Explanation:
abab is substring, ab repeated 2 times.
Input:
sequence = "a", word = "a"Output:
1Explanation:
The word "a" repeated 1 time is "a", which is a substring of "a". Repeating 2 times gives "aa" which is not a substring.
Input:
sequence = "aaabaaaaba", word = "aaba"Output:
1Explanation:
The word "aaba" repeated 1 time is a substring of "aaabaaaaba". Repeating 2 times gives "aabaaaba" which is not a substring.
Constraints
- •
1 ≤ sequence.length ≤ 100