Soul Stone Hashing

https://hack.codingblocks.com/practice/p/380/1555

There is wrong answer and also
run error.

Doubt-> Do we have to print all the substring having frequency greater than or equal to 2. or just only one substring having frequency highest among all?

u have to print one having the longest length
like abcabc
then abc are bc are repeating twice u have to print abc

Bhaiya Can you please Check the code, it is giving TLE.

ur complexity is greater than o(n^2) and constraint n can be 1000000
try to do it in n or n logn

But How can I generate substring of string in less than O(n^2)?

Bhaiya, Can you tell me how to approach this question.