Line no 37 and 41. You might be going out of bounds.
Consider the testcase:
1 5 1 5 1 hello 5 2 hello1 5 3 hello2 5 4 hello3 5 5 hello4
Thank you thank you so much for saving my hours to come to this test case.Finally I got the correct answer.
Mistake I was doing:
It was not necessary in this question that one person can have only one post . It may be possible that all posts are from him and even he posts nothing.This minor but important thing I missed.
Once again thank you for saving my efforts which I made on my previous code.
Yes I got it now. Thanks for replying:)