Source code for submission s1129

Go to diff to previous submission

Butg.java

  1. import java.util.Scanner;
  2. import java.io.BufferedReader;
  3. import java.io.InputStreamReader;
  4. import java.lang.*;
  5. import java.io.IOException;
  6.  
  7. class Butg{
  8.  
  9. public static void main (String []args) throws IOException{
  10.  
  11. Scanner sc = new Scanner(new InputStreamReader(System.in));
  12.  
  13. int numberOfLines = 0;
  14. String regex = "";
  15. String pattern = "";
  16. while(sc.hasNext()){
  17.  
  18. numberOfLines = sc.nextInt();
  19. regex = sc.next();
  20.  
  21. for(int i = 0; i < numberOfLines; i++){
  22.  
  23. pattern = sc.nextLine();
  24. pattern = pattern.replaceAll(regex, "");
  25. System.out.println(pattern);
  26.  
  27. }
  28.  
  29. }
  30.  
  31.  
  32.  
  33. }
  34.  
  35.  
  36. }
  37.  

Diff to submission s1087

Butg.java

--- c4.s1087.cteam107.bugs.java.0.Butg.java
+++ c4.s1129.cteam107.bugs.java.0.Butg.java
@@ -13,6 +9,5 @@
         public static void main (String []args) throws IOException{
 
-                InputStreamReader isr = new InputStreamReader(System.in);
-                Scanner sc = new Scanner(isr);
+                Scanner sc = new Scanner(new InputStreamReader(System.in));
 
                 int numberOfLines = 0;
@@ -25,10 +19,7 @@
                         regex = sc.next();
 
-                        //System.out.print(regex);
-                        BufferedReader br = new BufferedReader(isr,1024);
-                        
                         for(int i = 0; i < numberOfLines; i++){
                                 
-                                pattern = br.readLine();
+                                pattern = sc.nextLine();
                                 pattern = pattern.replaceAll(regex, "");
                                 System.out.println(pattern);