Source code for submission s1109

Go to diff to previous submission

Bugs.java

  1. /*
  2.  * To change this template, choose Tools | Templates
  3.  * and open the template in the editor.
  4.  */
  5. package bugs;
  6.  
  7.  
  8. import com.sun.rowset.internal.Row;
  9. import java.io.BufferedReader;
  10. import java.io.IOException;
  11. import java.io.InputStreamReader;
  12. import java.util.ArrayList;
  13. import java.util.List;
  14. import java.util.Scanner;
  15. import org.omg.PortableInterceptor.SYSTEM_EXCEPTION;
  16.  
  17. /**
  18.  *
  19.  * @author student
  20.  */
  21. public class Bugs {
  22.  
  23. /**
  24.   * @param args the command line arguments
  25.   */
  26. public static void main(String[] args) throws IOException {
  27. Scanner sc = new Scanner(System.in);
  28. List<String> result = new ArrayList<String>();
  29.  
  30.  
  31.  
  32. while (sc.hasNextInt()) {
  33. int rowCount = sc.nextInt();
  34. String text = sc.nextLine().trim();
  35.  
  36.  
  37. for (int i = 0; i < rowCount; i++) {
  38. String row2 = sc.nextLine();
  39. String tmp = row2.replace(text, "");
  40. result.add(tmp);
  41. //System.out.println(tmp);
  42. }
  43.  
  44. String row = sc.nextLine();
  45. if (row.length() ==0) break;
  46.  
  47. }
  48. for (String string : result) {
  49. System.out.println(string);
  50. }
  51. }
  52. }
  53.  

Diff to submission s1063

Bugs.java

--- c4.s1063.cteam124.bugs.java.0.Bugs.java
+++ c4.s1109.cteam124.bugs.java.0.Bugs.java
@@ -6,4 +6,5 @@
 
 
+import com.sun.rowset.internal.Row;
 import java.io.BufferedReader;
 import java.io.IOException;
@@ -25,9 +26,12 @@
     public static void main(String[] args) throws IOException {
         Scanner sc = new Scanner(System.in);
+        List<String> result = new ArrayList<String>();
         
+        
+       
         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++) {
@@ -38,7 +42,10 @@
             }
             
-            for (String string : result) {
-                System.out.println(string);
-            }
+            String row = sc.nextLine();
+            if (row.length() ==0) break;
+            
+        }
+        for (String string : result) {
+            System.out.println(string);
         }
     }