1668. 最大重复子字符串 思路 1.每次在主串查找子串,如果查找成功,次数+1 2.字串更新变成新的子串,用strcat连接,继续查找子串 class Solution { public int maxRepeating(String sequence, String word) { int count=0; String tmp=word; while(sequence.contains(word)){ word+=tmp; count++; } return count; } }