action22k FragEncode 8718
Михаил Авраменко, 441 группа FragEncode 9228
t1import syst1import sys
2data = sys.stdin.buffer.read()2data = sys.stdin.buffer.read()
3parts = data.split(b'\x00')3parts = data.split(b'\x00')
4if parts:4if parts:
5    text_bytes = parts[0]5    text_bytes = parts[0]
6    fragments = parts[1:]6    fragments = parts[1:]
7    if fragments and len(fragments[-1]) == 0:7    if fragments and len(fragments[-1]) == 0:
8        fragments.pop()8        fragments.pop()
9    try:9    try:
10        main_text = text_bytes.decode('utf-8')10        main_text = text_bytes.decode('utf-8')
11    except UnicodeDecodeError:11    except UnicodeDecodeError:
12        main_text = ''12        main_text = ''
13    encodings = ['cp866', 'cp1251', 'koi8-r', 'iso-8859-5']13    encodings = ['cp866', 'cp1251', 'koi8-r', 'iso-8859-5']
14    for frag in fragments:14    for frag in fragments:
15        found = False15        found = False
16        for enc in encodings:16        for enc in encodings:
17            try:17            try:
18                decoded = frag.decode(enc)18                decoded = frag.decode(enc)
19                if decoded in main_text:19                if decoded in main_text:
20                    found = True20                    found = True
21                    break21                    break
22            except UnicodeDecodeError:22            except UnicodeDecodeError:
23                continue23                continue
24        print('Yes' if found else 'No')24        print('Yes' if found else 'No')
Legends
Colors
 Added 
Changed
Deleted
Links
(f)irst change
(n)ext change
(t)op