Long substring with many repetitions
Problem 691
Given a character string , we define to be the length of the longest substring of which appears at least times in , or if such a substring does not exist. For example, because of the three occurrences of the substring , and because of the repeated substring . Note that the occurrences can overlap.
Let , and be the sequences defined by:
and the character string . You are given that , , , , , , , and that the sum of non-zero for is .
Find the sum of non-zero for .