Maximum Repeating Substring Leetcode Java