This question already has an answer here:
- Given a string find the substring which appears most often 5 answers
- Counting k-mers 4 answers
Given a string of no more than 255 characters, find a function that returns the longest recurring substring. An example would be:
where the longest recurring sub-string is aabba. I would preffer the answer in C/C++ as they are the only languages I know. The algorithm should be as fast as possible.