Someone Please explain why am I getting Wrong Answer.Here is my code http://ideone.com/HNMn2G
Sample Input:
38
123246
1234246
123659
9999
9
129999931
139999921
100
10000001
1000001
1
9
919
333999
33999
33399
9911
9991
911
199
1999
9876
987
1
9
0
8008
8007
1234
101
102
999
9999
998
948
1000
100
10001
Sample Output:
123321
1234321
124421
10001
11
139999931
139999931
101
10011001
1001001
2
11
929
334433
34943
33433
9999
9999
919
292
2992
9889
989
2
11
1
8118
8008
1331
111
111
1001
10001
999
949
1001
101
10101