> > Hint: you can move this check out of j-loop as condition is independent > of it. That's true, thanks. > > Also how many tokens are there? Is not quadratic solution too slow? > ~< 250 on most machines is what I've seen. To me that that's a small enough number that this is quick. It only happens at initialization.