primitive rabin-karp algorithm