add the kmp algorithm in c++,design in functor