got the bug fixed in my code and got AC.
still my older program does not give wrong output for just 1 data but for an entire class of data
Input Output(wrong) Output(Expected)
2107 2222 2112
3109 3223 3113
456156 457754 456654
etc .. there can be thousands of such inputs
Let me explain flaw in my code this may help to understand the problem better.
I was trying to check, if the last n/2 digits replaced by reverse of first n/2 digits to create a palindrome would create a palindrome larger than given num if yes output otherwise find the next (larger) palindrome
.eg: for 2107 a palindrome would be 21 - 12 , for 2133 also it would be 2112 but in this case since 2112 < 2133 we have to find next one (2222) .
But accidently i wrote the checking function wrong . thus it caused to output next palindrome for some more cases in which a digit in lower half is greater than the digitat at equal distance(from centre) in upper half.
eg: 3567( it would be split as 38 -67 here 7 is compared with 3 as 7>3 so my code increment 38 to 39 and generated palindrome 3993 whereas correct output is 3883 ,in this case we need not increment first part)
So i think hundreds of such cases can be created. Hence i assume test cases may not be sufficient.