You need to stop the while loop when "rr" reaches "col".

Awful variable names BTW.

Bye, Andreas