WA in k ordered LCS

ques: https://hack.codingblocks.com/contests/c/547/881
code: https://ide.codingblocks.com/s/62764

I have tried to tally it with bhaiya’s code but it gives WA on hackerblocks and gives partially correct on Hackerearth

check this
https://ide.codingblocks.com/s/62953

got my mistake thanks

got it , one extra else was messing it up thanks.