Detect the Domain Name

  • + 0 comments

    Python 3

    import re
    p = re.compile(r'https?://(w{3}|ww2)?(\.)?([a-z\d\-]+)(\.[a-z\d\-]+)+')
    s = ' '.join([input() for _ in range(int(input()))])
    print(';'.join(sorted(set([i.group().replace('http://', '').replace('https://', '').replace('www.', '').replace('ww2.', '') for i in re.finditer(p, s)]))))