很久之前不知道在哪儿顺来的Python脚本,大概原理很简单,不过这个写的比较精简
可以写在一个py文件里,命令行调用,也可以直接用这个zhalan()
函数
# e = '''KYsd3js2E{a2jda}'''
def zhalan(e):
elen = len(e)
field=[]
for i in range(2,elen):
if(elen%i==0):
field.append(i)
for f in field:
b = 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__':
e = raw_input("please input the strings:\n")
zhalan(e)