don't call strlen in the loop