Optimize num_tokens() to use only one pass through the string