Find the Longest Semi-Repetitive Substring