C++ implementation of pattern matching in text, using efficient algorithms