Also find non-branching repeats
Improved running time to O(n lg n)