2021-12-29 17:11:42 +01:00
|
|
|
import c3
|
|
|
|
|
|
|
|
content = None
|
|
|
|
with open('4.txt', 'r') as f:
|
|
|
|
content = f.read().splitlines()
|
2022-01-04 21:42:30 +01:00
|
|
|
if not content:
|
|
|
|
raise Error("Need content to proceed")
|
2021-12-29 17:11:42 +01:00
|
|
|
|
2022-01-04 21:42:30 +01:00
|
|
|
xs = []
|
2021-12-29 17:11:42 +01:00
|
|
|
for line in content:
|
|
|
|
try:
|
2022-01-04 21:42:30 +01:00
|
|
|
x = c3.decode_cipher(line)
|
|
|
|
if x: xs.append(x)
|
2021-12-29 17:11:42 +01:00
|
|
|
except:
|
|
|
|
continue
|
2022-01-04 21:42:30 +01:00
|
|
|
|
|
|
|
freqs = c3.frequency_table()
|
|
|
|
print(max(xs, key=lambda x: c3.score(x, freqs)))
|
|
|
|
|
|
|
|
################################################################################
|
|
|
|
# Answer
|
|
|
|
################################################################################
|
|
|
|
"Now that the party is jumping"
|