def transform st for in range len st st if len st st len st return

1
2
3
4
5
6
7
8
def transform(st):
r = ''
for i in range(len(st)/5):
q = st[i*5:(i+1)*5]
r += q[4]+q[0]+q[3]+q[1]+q[2];
if len(st)%5:
r += st[-(len(st)%5):]
return r