At first step, you need to implement a brute-force approach to solve the problem, to see
how much computation is required with respect to time and available space. That algorithm
checks the length of the match at every possible pair of starting positions, so it has ~O (n2
character comparisons, with the constant depending on match lengths. The working brute-force
algorithm presents a basis testbed for improving.
At second phase, you are required to improve brute-force method by removing some
inefficiencies or discovering some completely different method. Even though there are
considerable amount of algorithmic solutions to this problem, your approach should yield the
fastest one. Beside these, you should use available space reasonably as well.
Your program should read the input string from your own generated file and print the
results to standard output. You need to filter out any redundancies (non-printable characters etc.)
to eliminate the noises. Then, it should output the length of the repeated substring on the first line
and substring itself on the second line.