My code for this problem (https://www.codechef.com/MARCH19B/problems/CHDIGER) seems right to me and the testcases I am providing give right answer but after submission it shows wrong anser. Please Help!!!
My code is:-
/* package codechef; // don’t place package name! */
import java.util.;
import java.lang.;
import java.io.*;
/* Name of the class has to be “Main” only if the class is public. */
class Codechef
{
public static void main (String[] args) throws java.lang.Exception
{
// your code goes here
StringBuilder temp3=new StringBuilder();
StringBuilder temp4=new StringBuilder();
List list=new ArrayList<>();
int temp,length;
long n1,min;
String temp1,temp2,temp5;
Scanner sc=new Scanner(System.in);
int testCases=sc.nextInt();
for(int i=0;i<testCases;i++)
{ temp1=sc.next();
min=Integer.parseInt(temp1.toString());
length=temp1.length();
temp2=sc.next();
temp5= temp1+temp2;
for(int j=0;j<length;j++)
{temp4=new StringBuilder(temp5);
temp2=temp4.deleteCharAt(j).toString();
n1=Long.parseLong(temp2);
if(n1<min)
min=n1;
}
list.add(min);
}
for(int i=0;i<list.size();i++)
System.out.println(list.get(i));
}
}