Source code for submission s1283

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 java.io.IOException;
  9. import java.util.ArrayList;
  10. import java.util.List;
  11. import java.util.Scanner;
  12.  
  13. /**
  14.  *
  15.  * @author student
  16.  */
  17. public class Bugs {
  18.  
  19. /**
  20.   * @param args the command line arguments
  21.   */
  22. public static void main(String[] args) throws IOException {
  23. List<String> result = new ArrayList<String>();
  24.  
  25.  
  26. Scanner scanner = new Scanner(System.in);
  27. String line = scanner.nextLine();
  28.  
  29. while (line.length() > 0) {
  30. Scanner s = new Scanner(line);
  31. int rowCount = s.nextInt();
  32. String text = s.nextLine();
  33. text = text.substring(1, text.length());
  34.  
  35.  
  36. for (int i = 0; i < rowCount; i++) {
  37. String row2 = scanner.nextLine();
  38. String tmp = row2.replace(text, "");
  39. result.add(tmp);
  40. }
  41.  
  42. line = scanner.nextLine();
  43. }
  44. for (String string : result) {
  45. System.out.println(string);
  46. }
  47. }
  48. }
  49.  

Diff to submission s1166

Bugs.java

--- c4.s1166.cteam124.bugs.java.0.Bugs.java
+++ c4.s1283.cteam124.bugs.java.0.Bugs.java
@@ -21,12 +21,7 @@
      */
     public static void main(String[] args) throws IOException {
-        Scanner sc = new Scanner(System.in);
         List<String> result = new ArrayList<String>();
         
         
-       
-        //BufferedReader br =  new BufferedReader(new InputStreamReader(System.in));
-        //String line = br.readLine();
-        
         Scanner scanner = new Scanner(System.in);
         String line = scanner.nextLine();
@@ -35,5 +30,6 @@
             Scanner s = new Scanner(line);
             int rowCount = s.nextInt();
-            String text = s.nextLine().trim();
+            String text = s.nextLine();
+            text = text.substring(1, text.length());
            
             
@@ -43,6 +39,6 @@
                 result.add(tmp);
             }
-            line = scanner.nextLine();
                     
+            line = scanner.nextLine();
         }
         for (String string : result) {