Please move `strlen()` out of loop.