抱歉,您的浏览器无法访问本站
本页面需要浏览器支持(启用)JavaScript
了解详情 >


Python RailFenceCipher

RailFenceCipher.py
#coding=utf-8
def railFenceCipher():
e = input()
elen = len(e)
field=[]
for i in range(2,elen):
if(elen%i==0):
field.append(i)
for f in field:
b = int(elen / f)
result = {x:'' for x in range(b)}
for i in range(elen):
a = i % b;
result.update({a:result[a] + e[i]})
d = ''
for i in range(b):
d = d + result[i]
print (d.lower())

if __name__ == '__main__':
try:
while True:
railFenceCipher()
except EOFError:
exit()
推荐阅读
Mac Code Test Mac Code Test Python ASCII 字符串 转换 Python ASCII 字符串 转换 Python Baconian Python Baconian Cryptography Cryptography Python Morse Python Morse Python Caesar Python Caesar

留言区

Are You A Robot?