Source code for submission s854

Go to diff to previous submission

Bugs.java

  1. import java.util.*;
  2. import java.util.Scanner;
  3. import java.io.*;
  4.  
  5. public class Bugs {
  6. public static void main(String[] args) throws Exception {
  7.  
  8. while (true) {
  9. String f = reader.readLine();
  10. if (f.equals("")) break;
  11. String v[] = f.split(" ");
  12.  
  13. int t = Integer.parseInt(v[0]);
  14. for (int i = 1; i <= t; i++) {
  15. String s = reader.readLine();
  16. while (s.contains(v[1])) {
  17. s = s.replace(v[1], "");
  18. }
  19. System.out.println(s);
  20. }
  21. }
  22.  
  23. }
  24.  
  25. }
  26.  
  27.  

Diff to submission s770

Bugs.java

--- c4.s770.cteam071.bugs.java.0.Bugs.java
+++ c4.s854.cteam071.bugs.java.0.Bugs.java
@@ -5,25 +5,21 @@
 public class Bugs {
         public static void main(String[] args) throws Exception {
-                int t,i;
-                String b;
+                
                 BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
-                Scanner sc = new Scanner(System.in);
-                while (sc.hasNextInt()) {
-                        t = sc.nextInt();
-                        /*System.out.println(t);*/
-                        b = sc.nextLine();
-                        b = b.replace(" ", "");
-                        /*System.out.println(b);*/
-                        for (i = 1; i <= t; i++) {
-                                /*System.out.println("bent");*/
-                                String s = sc.nextLine();
-                                /*System.out.println(s);*/
-                                while (s.contains(b)) {
-                                        s = s.replace(b, "");
+                while (true) {          
+                        String f = reader.readLine();
+                        if (f.equals("")) break;
+                        String v[] = f.split(" ");
+                        
+                        int t = Integer.parseInt(v[0]);
+                        for (int i = 1; i <= t; i++) {
+                                String s = reader.readLine();
+                                while (s.contains(v[1])) {
+                                        s = s.replace(v[1], "");
                                 }
                                 System.out.println(s);
                         }
-                        
                 }
+                
         }