Processing math: 100%
Frequent substring - MarisaOJ: Marisa Online Judge

Frequent substring

Time limit: 1000 ms
Memory limit: 256 MB
Given a string S. Find the longest string appearing at least k times in S. ### Input - The first line contains a string S. - The second line contains an integer k. ### Output - Print the length of the longest string appearing at least k times in S. ### Constraints - 1≤k≤|S|≤105. ### Example Input: aaba2 Output: 2 #### Note: String ab.