You are viewing a single comment's thread. Return to all comments →
Java 8 Solution
public class Solution { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = Integer.parseInt(in.nextLine().trim()); Pattern pa = Pattern.compile("http[s]?:\\/\\/(ww[w2]\\.)?(([a-zA-Z0-9\\-]+\\.)+([a-zA-Z\\-])+)"); TreeSet<String> set = new TreeSet<>(); while (n-- > 0) { String input = in.nextLine(); Matcher ma = pa.matcher(input); while (ma.find()) set.add(ma.group(2)); } for (String str : set) { System.out.print((str != set.last()) ? str + ";" : str); } } }
Seems like cookies are disabled on this browser, please enable them to open this website
Detect the Domain Name
You are viewing a single comment's thread. Return to all comments →
Java 8 Solution