Go to diff to previous submission
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Scanner; public class Bugs { while (true) { if (vstupRadka == null) { break; } Scanner sc = new Scanner(vstupRadka); int n = sc.nextInt(); for (int i = 0; i < n; i++) { if (!radka.contains(slovo)) { } else { while (true) { if (novy.equals(stary)) { break; } stary = novy; } } } } } }
--- c4.s828.cteam118.bugs.java.0.Bugs.java +++ c4.s881.cteam118.bugs.java.0.Bugs.java @@ -28,5 +28,13 @@ System.out.println(radka); } else { - System.out.println(radka.replace(slovo, "")); + String stary = radka; + while (true) { + String novy = stary.replace(slovo, ""); + if (novy.equals(stary)) { + System.out.println(novy); + break; + } + stary = novy; + } } }