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 \le k \le |S| \le 10^5$. ### Example Input: ``` aababbb 2 ``` Output: ``` 2 ``` #### Note: String `ab`.