modified the kmp.cpp file