import sys import re import random BAD_URLS vkontakte ru NEW_URLS open

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import sys
import re
import random
BAD_URLS = [
'*.vkontakte.ru'
]
NEW_URLS = [
'opennet.ru',
'sql.ru'
]
def modify_url(line):
list = line.split(' ')
old_url = list[0]
new_url = '\n'
if re.split(url, old_url) for url in BAD_URLS]:
new_url = random.sample(NEW_URLS)
return new_url
while True:
line = sys.stdin.readline().strip()
new_url = modify_url(line)
sys.stdout.write(new_url)
sys.stdout.flush()