After watching this video [Algorithms Live! Episode 3 — Rolling Hashes and Bloom Filters](https://www.youtube.com/watch?v=rA1ZevamGDc), I tried to implement pull character from last by myself. I am using 10^9+7 and 10^9+9 as mods. It's giving correct answer for 10^9+7, but giving some weird values for 10^9+9. Can anyone please help finding the problem?↵
↵
Code : [My code](https://ideone.com/2YsOxs)↵
↵
Edit: Did a silly mistake. Found the problem. and applying it on this problem here: ↵
↵
Problem: [1423. String Tale](http://acm.timus.ru/problem.aspx?space=1&num=1423)↵
↵
Code : [My code](https://ideone.com/M9a9w4)↵
↵
Is my implementation wrong? if so, what is wrong in this? or can anyone give a code that works like the same principle as the video and works perfectly?↵
↵
Thanks in advance.
↵
Code : [My code](https://ideone.com/2YsOxs)↵
↵
Edit: Did a silly mistake. Found the problem.
↵
Problem: [1423. String Tale](http://acm.timus.ru/problem.aspx?space=1&num=1423)↵
↵
Code : [My code](https://ideone.com/M9a9w4)↵
↵
Is my implementation wrong? if so, what is wrong in this? or can anyone give a code that works like the same principle as the video and works perfectly?↵
↵
Thanks in advance.