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:
"ab" repeated 2 times is "abab", which is a substring of "ababc". So the maximum repeating value is 2.
Input:
sequence = "a", word = "a"Output:
1Explanation:
The word can appear once but not twice in the sequence. The exact output is 1.
Input:
sequence = "aaabaaaaba", word = "aaba"Output:
1Explanation:
The word can appear once but not twice in the sequence. The exact output is 1.
Constraints
- •
1 ≤ sequence.length ≤ 100