template < class CharStack >
bool checkMatch (char *b, char *e)
/*   For checkMatch(b, e), pointer b references to the first char to be
considered and e points one beyond the last.  Thus
e-b is the length of the array of chars to be considered.

checkMatch(b, e) returns true iff the '()' and '[]'
match up properly.

Example: for "(a)b[c] d([e (( f[g] )h) i])j" checkMatch must
return true, but if you leave out any one (,[,0, or ] in 
that example it must return false.
*/
{
	CharStack S;
	while (b < e) {
	   if (*b == '(' or *b == '[') 
		   S.push(*b);
	   else if ( (*b == ')' and S.top() == '(' )
                  or 
				 (*b == ']' and S.top() == '[' ) 
			   )
            S.pop();
	   // else none of those 4 characters, so
       ++b; // increment to next letter.
   }
   return S.isEmpty();
}
/* Question:  Is there a logic error in checkMatch?
 * A.  Returns "false" sometimes when the nesting is actually 
 * perfect.
 * B.  Returns "true" sometimes when the nesting is bad.
 * C.  Crashes or infinite loop on some input strings.
 * D.  No error, it is correct.
 * E.  Two or more of A,B,C are true.
 */
