Learning C++ with KMP string search