The only hard part is determining how long each line is when you cut the ciphertext up, and
you can figure that out by dividing the length of the text by k + (k-2) where k is the number of rails,
and looking at the remainder.
Then you just bounce from line 1 to 2 to 3 to 4 to 5 to 4 to 3 to 2 to 1 …. (for key=5, for example).