rail-fence
This commit is contained in:
1
rail_fence/message.txt
Executable file
1
rail_fence/message.txt
Executable file
@@ -0,0 +1 @@
|
|||||||
|
Ta _7N6DDDhlg:W3D_H3C31N__0D3ef sHR053F38N43D0F i33___NA
|
||||||
47
rail_fence/sol.py
Executable file
47
rail_fence/sol.py
Executable file
@@ -0,0 +1,47 @@
|
|||||||
|
#!/home/maxime/.pyvenv/bin/python3
|
||||||
|
|
||||||
|
with open("message.txt", 'r') as f:
|
||||||
|
text = f.read()
|
||||||
|
|
||||||
|
dec = [" "] * len(text)
|
||||||
|
i = 0
|
||||||
|
j = 0
|
||||||
|
while True:
|
||||||
|
dec[j] = text[i]
|
||||||
|
i += 1
|
||||||
|
j += 6
|
||||||
|
if j >= len(text):
|
||||||
|
break
|
||||||
|
j = 1
|
||||||
|
while True:
|
||||||
|
dec[j] = text[i]
|
||||||
|
i += 1
|
||||||
|
j += 4
|
||||||
|
if j >= len(text):
|
||||||
|
break
|
||||||
|
dec[j] = text[i]
|
||||||
|
i += 1
|
||||||
|
j += 2
|
||||||
|
if j >= len(text):
|
||||||
|
break
|
||||||
|
j = 2
|
||||||
|
while True:
|
||||||
|
dec[j] = text[i]
|
||||||
|
i += 1
|
||||||
|
j += 2
|
||||||
|
if j >= len(text):
|
||||||
|
break
|
||||||
|
dec[j] = text[i]
|
||||||
|
i += 1
|
||||||
|
j += 4
|
||||||
|
if j >= len(text):
|
||||||
|
break
|
||||||
|
j = 3
|
||||||
|
while True:
|
||||||
|
dec[j] = text[i]
|
||||||
|
i += 1
|
||||||
|
j += 6
|
||||||
|
if j >= len(text):
|
||||||
|
break
|
||||||
|
print(''.join(dec))
|
||||||
|
|
||||||
Reference in New Issue
Block a user