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.length()>0) { for (int i = 0; i < rowCount; i++) { rows.add(tmp); } } } } }
--- c4.s914.cteam124.bugs.java.0.Bugs.java +++ c4.s934.cteam124.bugs.java.0.Bugs.java @@ -22,10 +22,10 @@ public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); - String row = br.readLine(); + StringBuffer row = new StringBuffer(br.readLine()); ArrayList<String> rows = new ArrayList<String>(); - - while(!row.equals("")) { - String[] split = row.split(" "); + + while(row.length()>0) { + String[] split = row.toString().split(" "); int rowCount = Integer.valueOf(split[0]); String text = split[1]; @@ -36,5 +36,5 @@ rows.add(tmp); } - row = br.readLine(); + row = new StringBuffer(br.readLine()); }