wrong answer even after passing basic test cases.

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();
temp5= temp1+temp2;

  for(int j=0;j<length;j++)
  {temp4=new StringBuilder(temp5);
   for(int i=0;i<list.size();i++)


First of all please delete this question as soon as possible as this question is from an ongoing contest and asking question from ongoing contests is against the Codechef Code of conduct and might get you banned.
Ans passing basic test cases doesn’t mean that your program will get right answer as there are lots of other test cases for which your program should be working too.

I didn’t see the logic as such, but you can try changing StringBuilder to String.
StringBuilder is although faster than StringBuffer and much faster than String, is not thread safe.
Maybe the codechef judge doesn’t run everyone’s program in separate threads (obviously, due to heavy traffic and memory constraints).
(Anybody who knows the ground reality can correct me, if I am wrong in this assumption)
Maybe that’s the issue due to which you are getting a wrong answer.
I was also getting a “WA” in one question from Jan 2021 challenge, so I changed the StringBuilder class to String to get an “AC”.