for better performance it is better to move count($tokens) to for`s initialization section