import java.util.Scanner; public class FindSmallestPalindrome { public static void main(String args[]){ Scanner s = new Scanner(System.in); //System.out.println("Enter the number"); int testCase = s.nextInt(),i=1; long st; StringBuilder str = new StringBuilder(); while(i <= testCase){ st = s.nextLong(); st +=1; while(st <= 1000000000){ str.append(st); //System.out.println("str="+str); if(str.reverse().toString().equals(st+"")){ //System.out.println("str inside="+str); System.out.println(st); break; } str.delete(0,str.length()); st++; //System.out.println("temp="+st); } i++; } } }
I don't know how to remove NZEC error;
problem:http://www.spoj.com/problems/PALIN/
Explain the error in program.