Not getting correct output

I am not getting correct output in this question. for sample test case i am getting 1 as answer.
the link of my code :

I have edited your code… Try to submit it now…