optimized strlen() out of the loop