Testcases not passing

why is my code not passing all the testcases ? What is wrong with my code? Help me identify me error and rectify it ASAP.

hello @D19APPPP0016
use MOD property here as well.
image

it should be
dp[i]=(dp[i]%mod -dp[last[str[i-1]]]%mod + mod) %mod;