Need C++ implementation of KMP algorithm

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).
Duck found this very simple implementation; (test it thoroughly before accepting it).
https://github.com/n2yen/KMP/blob/master/cpp/kmp.cpp
Topic archived. No new replies allowed.