Skip to content

Commit

Permalink
Improved tasks 1106, 1108.
Browse files Browse the repository at this point in the history
  • Loading branch information
javadev authored Feb 28, 2022
1 parent b7e996c commit 7fdfde8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;

public class Solution {
private String source;
Expand Down Expand Up @@ -95,6 +97,7 @@ private boolean match(char ch) {

private void consume(char ch, String message) {
if (!match(ch)) {
Logger.getLogger(Solution.class.getName()).log(Level.SEVERE, () -> message);
return;
}
advance();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package g1101_1200.s1108_defanging_an_ip_address;

// #Easy #String #2022_02_28_Time_3_ms_(26.20%)_Space_42.8_MB_(5.79%)
// #Easy #String #2022_02_28_Time_0_ms_(100.00%)_Space_42.6_MB_(5.79%)

public class Solution {
public String defangIPaddr(String address) {
return address.replaceAll("\\.", "\\[\\.\\]");
return address.replace(".", "[.]");
}
}

0 comments on commit 7fdfde8

Please sign in to comment.