I am looking for a simple C++ implementation of KMP (Knuth-Morris-Pratt) algorithm. I was able to understand the concept from this article https://www.w3spot.com/2020/07/kmp-algorithm-explained-in-plain-english.html . But it didn't have a code implementation. I checked few other places, but code was pretty hard to go through. Please share some compact implementation of KMP in C++ (preferably with comments).