sorting works, but w/o RegExp
only checks distance of b from the first occurrence of a
finds all occurrences of a then checks for b; not just first occurrence