Phase I: rewrote longest_substr to search longest to shortest and ignore all candidates shorter than current longest substring