All Submissions


Often I need to extract urls from text file and I hate doing this manually. I know there are library functions which can do this, but not all url is useful for me. Only those urls which satisfy following conditions are important for me.

Syntax of urls is scheme://sub-domain.top-level-domain/path?query_string
com, in, org, gov, uk, pk, etc are called top level domain, everything else is sub domain.

1. Only http or https scheme is allowed.
2. Top level domain as well as sub domain should be of at least 2 chars.
3. Top level domain can contain only letters
4. Sub domain can contain letters, numbers and -
5. Sub domain cannot start or end with -
6. Domain part of link cannot contain consecutive '.' (dot)
7. Path can contain letters, numbers, '+', '&', '#', '\', '/', '%', '?', '=', '_', '.' and '-'
8. Query String can contain letters, numbers, '+', '&', '?', '#', '\', '/', '?' and '-'

NOTE : I don't like very large code so I have set the maximum file size to 500 bytes :P.

Input Specifications
You have to read till EOF.
Each line contains a test case.
A test case can contain several urls.

Output Specifications
For each test case print all valid urls on seprate line.
After each test case print a blank line.

Constrains
0 <= length of test case <= 500

Sample Input

Valid Links : Google ( http://www.google.com/ ), Facebook ( https://www.facebook.com/ )
Invalid Links : http://ww.-ww.ww/ http://ww.ww-.ww/ http://www.google.c/
https://www.youtube.com/

Sample Output

http://www.google.com/
https://www.facebook.com/


https://www.youtube.com/



Problem Setter : Pushkar Anand
Problem Tester : Dhruva Bhaswar

Languages: AWK,Bash,Brain,C#,JavaScript,Pascal,Perl,PHP,Python,Python3,Ruby,Text

Time Limit: 1 Second(s)
Score: 100 Point(s)
Input File Limit: 500 Bytes

Submit

Login to post clarification.

No Clarifications.

Contest

Mode Judge

Passive

Online

Overall Rankings

RankNameScore
1xyz0
2Ams0
3TIP0
4team420
5xyzz0
6asdasdasd0
7abcd0
8khankhan0
9Gabriel0
10gigel0