Change while( <IN> ) { to while( <INPUT> ) { and it may work better.
In reply to Re^2: Dealing with huge text string by jwkrahn in thread Dealing with huge text string by PhilFromIndy