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 (line.length() > 0) { Scanner s = new Scanner(line); int rowCount = s.nextInt(); for (int i = 0; i < rowCount; i++) { result.add(tmp); //System.out.println(tmp); } // String row = sc.nextLine(); // if (row.length() ==0) break; line = br.readLine(); } } } }
--- c4.s1109.cteam124.bugs.java.0.Bugs.java +++ c4.s1133.cteam124.bugs.java.0.Bugs.java @@ -30,11 +30,16 @@ - while (sc.hasNextInt()) { - int rowCount = sc.nextInt(); - String text = sc.nextLine().trim(); + BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); + String line = br.readLine(); + + + while (line.length() > 0) { + Scanner s = new Scanner(line); + int rowCount = s.nextInt(); + String text = s.nextLine().trim(); for (int i = 0; i < rowCount; i++) { - String row2 = sc.nextLine(); + String row2 = br.readLine(); String tmp = row2.replace(text, ""); result.add(tmp); @@ -42,7 +47,10 @@ } - String row = sc.nextLine(); - if (row.length() ==0) break; +// String row = sc.nextLine(); +// if (row.length() ==0) break; + + line = br.readLine(); + } for (String string : result) {