Completed delimiter algorithm, passes all tests