When I change
while (sc.hasNext()||sc.nextInt()!=0){
int dem=sc.nextInt();
String st=sc.next();
if ((st.equals("")==false) & (dem>=2)){
Do d= new Do(st,dem);
}
System.out.println();
}
into
while (sc.hasNextLine()){
int dem=sc.nextInt();
if (dem==0){
break;
}
else{
String st=sc.next();
if ((st.equals("")==false) & (dem>=2)){
Do d= new Do(st,dem);
}
System.out.println();
}
It 'll be accepted....I don't know why 