Ruby Rabin–Karp algorithm