C5: WA on codechef but AC on Uva oj

My code here is working perfectly fine on Uva Oj but after modifying a little bit, it’s giving WA on codechef

i have used O(n) backtracking instead of the O(n^2) backtracking used in the solutions, for printing the LICS

//