Implement "Text Queries" from section 15.9 in C++ Primer.