brute force(BF) and Knut-Morris-Pratt(KMP)