Go to diff to previous submission
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package bugs; import com.sun.rowset.internal.Row; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.List; import java.util.Scanner; import org.omg.PortableInterceptor.SYSTEM_EXCEPTION; /** * * @author student */ public class Bugs { /** * @param args the command line arguments */ List<String> result = new ArrayList<String>(); while (sc.hasNextInt()) { int rowCount = sc.nextInt(); for (int i = 0; i < rowCount; i++) { result.add(tmp); //System.out.println(tmp); } if (row.length() ==0) break; } } } }
--- c4.s1063.cteam124.bugs.java.0.Bugs.java +++ c4.s1109.cteam124.bugs.java.0.Bugs.java @@ -6,4 +6,5 @@ +import com.sun.rowset.internal.Row; import java.io.BufferedReader; import java.io.IOException; @@ -25,9 +26,12 @@ public static void main(String[] args) throws IOException { Scanner sc = new Scanner(System.in); + List<String> result = new ArrayList<String>(); + + while (sc.hasNextInt()) { int rowCount = sc.nextInt(); String text = sc.nextLine().trim(); - List<String> result = new ArrayList<String>(); + for (int i = 0; i < rowCount; i++) { @@ -38,7 +42,10 @@ } - for (String string : result) { - System.out.println(string); - } + String row = sc.nextLine(); + if (row.length() ==0) break; + + } + for (String string : result) { + System.out.println(string); } }