Another nasty problem results from using the index of the string. That is, if you omit the cast of
begIdx to int, this program might run in an endless loop or might crash. Similar to the first example
program, the problem is that string::size_type is an unsigned integral type. Without the cast,
the signed value i is converted automatically into an unsigned value because it is compared with a
unsigned type. In this case, the following expression always yields true if the current word starts at
the beginning of the line: