Go to diff to previous submission
import java.io.BufferedReader; /* * To change this template, choose Tools | Templates * and open the template in the editor. */ import java.io.IOException; import java.io.InputStreamReader; class Bugs { /** * @param args the command line arguments */ while(true){ if(firstLine == null) return; // System.out.println(errorCode + " " + errorCode.length()); int errorCodeLength = errorCode.length(); for (int i = 0; i < lineCount; i++) { line = br.readLine(); if(line.length() >= errorCodeLength){ while(line.contains(errorCode)){ line = line.replaceAll(errorCode, ""); } } } } } }
--- c4.s609.cteam037.bugs.java.0.Bugs.java +++ c4.s629.cteam037.bugs.java.0.Bugs.java @@ -23,11 +23,15 @@ String errorCode = firstLine.substring(firstWords[0].length() + 1); // System.out.println(errorCode + " " + errorCode.length()); + int errorCodeLength = errorCode.length(); + String line = ""; for (int i = 0; i < lineCount; i++) { - String line = br.readLine(); - while(line.contains(errorCode)){ + line = br.readLine(); + if(line.length() >= errorCodeLength){ + while(line.contains(errorCode)){ - line = line.replaceAll(errorCode, ""); - } + line = line.replaceAll(errorCode, ""); + } + } System.out.println(line); }