Detect the Domain Name

  • + 0 comments
    import re
    import sys
    N = int(input())
    S = sys.stdin.read()
    List = sorted(set(re.findall(r'(?<=://)[\w\d-]+[\.]+[\w\.-]+',S)))
    
    for i in range(len(List)):
        List[i] = re.sub("www.","",List[i])
        List[i] = List[i].rstrip("_")
    print(*sorted(set(List)),sep=";")