SPOJ : BROKEN

I am getting WA on this problem

My code is

Please help me .

Thank you in advance.

there are two bugs.
→ for test case 1 a your code outputs 0.
initialize maxi with 1
→ for test case 2 aa your code outputs 1
you are not checking if we get maximum value in dp[c] when c=ab.size()-1 and t<=different
add maxi=max(dp[i],maxi) at the end of the loop

accepted code ideone link

Thank buddy got AC!!!
Thanks