Implement Rabin Karp algorithm