Boyer-Moore实现
#include <iostream> #include <vector> #include <algorithm> #include <set> #include <string> #include <cstring> namespace patternMatch{ using namespace std; class boyerMoore{ public: boyerMoore(void):skip(NULL), shift(NULL), charMax(256){} int bmMake(const string &patternStr){ if( shiftMake(patternStr) < 0 || skipMake(patternStr) < 0) return -1; pattern = patternStr; } ~boyerMoore(void){ bmDesory(); } const int match(const string &target) const{ if(pattern.empty() || !shift || !skip || target.size() > pattern.size()) return -1; int targetLen = target.size(); int patternLen = pattern.size(); int