Go to diff to previous submission
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package bugs; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; /** * * @author student */ public class Bugs { /** * @param args the command line arguments */ ArrayList<String> rows = new ArrayList<String>(); while(!row.equals("")) { for (int i = 0; i < rowCount; i++) { rows.add(tmp); } row = br.readLine(); } } } }
--- c4.s889.cteam124.bugs.java.0.Bugs.java +++ c4.s914.cteam124.bugs.java.0.Bugs.java @@ -7,10 +7,7 @@ import java.io.BufferedReader; -import java.io.Reader; -import java.io.StringReader; +import java.io.IOException; +import java.io.InputStreamReader; import java.util.ArrayList; -import java.util.LinkedList; -import java.util.List; -import java.util.Scanner; /** @@ -23,8 +20,7 @@ * @param args the command line arguments */ - public static void main(String[] args) { - - Scanner scanner = new Scanner(System.in); - String row = scanner.nextLine(); + public static void main(String[] args) throws IOException { + BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); + String row = br.readLine(); ArrayList<String> rows = new ArrayList<String>(); @@ -32,14 +28,13 @@ while(!row.equals("")) { String[] split = row.split(" "); - int rowCount = Integer.parseInt(split[0]); + int rowCount = Integer.valueOf(split[0]); String text = split[1]; for (int i = 0; i < rowCount; i++) { - String row2 = scanner.nextLine(); + String row2 = br.readLine(); String tmp = row2.replace(text, ""); - //System.out.println(row2); rows.add(tmp); } - row = scanner.nextLine(); + row = br.readLine(); }