Final version of Rabin-Karp