In my output one string is missing,i used merge sort

please look at my code
import java.util.*;
public class Main {
public static void main(String args[]) {
Scanner scn=new Scanner(System.in);
int n=scn.nextInt();
String [] s=new String[n];

	for(int i=0;i<n;i++){
		s[i]=scn.nextLine();
		
	}
	
	String [] result=Stringsort(s,0,n-1);
	//System.out.println(result);
	for(int i=0;i<result.length;i++){
		System.out.println(result[i]);
	}
	


}
public static String [] Stringsort(String [] s,int b,int e){
	if(b==e){
		return new String[] {s[b]};
	}
	int mid=(b+e)/2;
	String [] res1=Stringsort(s,b,mid);
	String [] res2=Stringsort(s,mid+1,e);
	int i=0;
	int j=0;
	int k=0;
	int size=res1.length+res2.length;
	String [] mixed=new String [size];
	while(i<res1.length && j<res2.length){
		if(res1[i].compareTo(res2[j])<0){
			mixed[k]=res1[i];
			
			i+=1;
		}
		else{
			mixed[k]=res2[j];
			
			j+=1;
		}
		k+=1;
	}
	while(i<res1.length){
		mixed[k]=res1[i];
		i+=1;
		k+=1;
	}
	while(j<res2.length){
		mixed[k]=res2[j];
		j+=1;
		k+=1;
	}
	return mixed;


	
}

}

please share your code after saving it on ide.codingblocks.com

Now I am in collabaration mode.

please have a look…

@naveenkumpatla
Line No. 8
Use scn.next() instead of scn.nextLine() to take input.

I used next() what is the difference between using next and nextLine

Also on submission my testcases are failed please have a look in the ide

your string is missing because your code is reading the first string as the space after n.
after input n take a stray nextLine input to move to the next line like this:

int n=scn.nextInt();
String [] s=new String [n];
scn.nextLine();
for(int i=0;i<n;i++){
       s[i]=scn.nextLine();         
 }

Don’t forget: if a string is present completely as a prefix in another string, then string with longer length should come first. Eg bat, batman are 2 strings and the string bat is present as a prefix in Batman - then sorted order should have - Batman, bat.