Please help as only one of the test case is passing

@sarthaksingh
Hello Sarthak,
your code line number 12 should be as follows
ans = (ans-dp[v[s[i-1]]]+1000000007)%1000000007;
because of modulo property
i.e (a-b)%m = (a-b+m)%m

rest of ur code is totally correct .
please don’t forget to mark your doubt as resolved

@sarthaksingh @sarthaksingh
hello sarthak,please mark your doubt as resolved

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.