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; 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 */ while (sc.hasNextInt()) { int rowCount = sc.nextInt(); List<String> result = new ArrayList<String>(); for (int i = 0; i < rowCount; i++) { result.add(tmp); //System.out.println(tmp); } } } } }
--- c4.s1046.cteam124.bugs.java.0.Bugs.java +++ c4.s1063.cteam124.bugs.java.0.Bugs.java @@ -10,4 +10,5 @@ import java.io.InputStreamReader; import java.util.ArrayList; +import java.util.List; import java.util.Scanner; import org.omg.PortableInterceptor.SYSTEM_EXCEPTION; @@ -24,17 +25,21 @@ public static void main(String[] args) throws IOException { Scanner sc = new Scanner(System.in); - - while (sc.hasNext()) { + 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++) { String row2 = sc.nextLine(); String tmp = row2.replace(text, ""); - System.out.println(tmp); + result.add(tmp); + //System.out.println(tmp); + } + + for (String string : result) { + System.out.println(string); } } - } }