base implementation using simple KMPs, GMM and GMR