Why my code is giving NZEC error

import java.util.Scanner;
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)
	{
		Scanner sc= new Scanner(System.in);
		int tcases= sc.nextInt();
		for(int m=1; m<=tcases; m++) 
		{
		
	
			
			int length=sc.nextInt();;
			int a[] = new int[length];
			
			for(int j=0; j<length-1; j++) 
				a[j] = sc.nextInt();
		
			String s1="";
			for(int i=0; i<length-1; i++) 
			{
				int first=a[i];
				int last=a[i+1];
				int count=0;
				while(i<length && a[i]+1==a[i+1]) 
				{
					count++;
					last=a[i+1];
					i++;
				}
				if(count>=2) 
					s1=s1.concat(first+"..."+last+",");
			
				else 
					s1=s1.concat(first+","+last+",");
			
			
			}
			String s2= s1.substring(0,s1.length()-1);
			System.out.println(s2);
		}
		sc.close();
	}
}

why it is giving me NZEC error but the code works fine in my system.
can someone explain me

you may not have given input in codechef IDE