All Hidden Test Cases are not Passing

Hello TA,
My code is giving right answers on sampl3e test cases and on some hidden test cases, but is given WA on some hidden test case, can you please help, that what exactly my doing wrong in my code!
CODE : https://ide.codingblocks.com/s/246466

Change line 18 to dp[i] = (dp[i] - dp[last[s[i-1]]]+MOD)%MOD;

1 Like

It worked. Thanks :slight_smile: Can you please tell that why we added that MOD thing again?

It’s the basic property.
(a-b)%m=(a%m-b%m+m)%m;

1 Like

Oh. Okay. Thanks a lot!