I was introduced to this problem by someone on another platform; I have been thinking about the problem for a while, but I don't know what to do.
You are given string $$$T$$$ and a function $$$f(s)$$$. $$$f(s)$$$ takes in a string and outputs $$$len(s) * occur(s)$$$ where $$$len(s)$$$ is the length of the string and $$$occur(s)$$$ is the amount of times string $$$s$$$ occurs in $$$T$$$.
Find the maximum value of $$$f(s)$$$ over all substrings of $$$T$$$.
I am considering using the Z-algorithm to solve this; can someone tell me if this is the correct approach?