-
-
Save mosmeh/31b07b34297ff4a5393bd45d68e8ef02 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
code="""spwwz pgpcjzyp! hpwnzxp ez esp hzcwo zq nzxafepc dntpynp! | |
nzxafepc dntpynp td l mldtd zq esp xzopcy tyqzcxletzy lyo | |
nzxxfytnletzy epnsyzwzrj dfns ld mtr olel lylwjdtd, lt, lyo lwdz | |
nzxafepc rlxp. awpldp pyuzj esp hzcwo zq nzxafepc dntpynp. dpp | |
jzf lrlty le seea://end.n.etepns.ln.ua/ndmzzv/""" | |
def rot(c, n): | |
if 'a' <= c and c <= 'z': | |
return chr((ord(c) - ord('a') - n) % 26 + ord('a')) | |
else: | |
return c | |
def count_e(n): | |
count = 0 | |
for c in code: | |
if rot(c, n) == 'e': | |
count += 1 | |
return count | |
counts = sorted([(i, count_e(i)) for i in range(0, 26)], key=lambda x: x[1], reverse=True) | |
n = counts[0][0] | |
print(n) | |
print(''.join(rot(c, n) for c in code)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment