t,x=eval(input())print("\n".join([t[c:c+x].ljust(x)[::1-2*(int(c/x)%2)] for c in range(0,len(t),x)]))
"Programming Puzzles & Code Golf", 4
Prog mmar ing zzuP les oC & de G flo
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!