add the longest repeated substring solution