A snakified string looks like this:
T AnE eOf ifi ing
h s x l A k e r
isI amp Sna dSt
Your Task
Take a string s
and a size n
, then output the snakified string. The inputs ThisIsAnExampleOfaSnakifiedString
and 3
would produce the example above.
Specifications
s
will only contain ASCII characters between code points 33 and 126 inclusive (no spaces or newlines).s
will be between 1 and 100 characters long.n
is an integer representing the size of each output string segment. Each line of characters (up/down or left/right) that make up the curves in the "snake" isn
characters long. See the test cases for examples.n
will be between 3 and 10 inclusive.- The output string always starts pointing downwards.
- Trailing spaces on each line are allowed.
- Trailing newlines at the end of the output are also allowed.
- Leading spaces are not allowed.
- code-golf means shortest code in bytes wins.
Test Cases
a 3
a
----------
Hello,World! 3
H Wor
e , l
llo d!
----------
ProgrammingPuzzlesAndCodeGolf 4
P ngPu Code
r i z d G
o m z n o
gram lesA lf
----------
IHopeYourProgramWorksForInputStringsWhichAre100CharactersLongBecauseThisTestCaseWillFailIfItDoesNot. 5
I gramW tStri 100Ch gBeca CaseW DoesN
H o o u n e a n u t i t o
o r r p g r r o s s l I t
p P k n s A a L e e l f .
eYour sForI Which cters ThisT FailI
----------
!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ 10
! <=>?@ABCDE `abcdefghi
" ; F _ j
# : G ^ k
$ 9 H ] l
% 8 I \ m
& 7 J [ n
' 6 K Z o ~
( 5 L Y p }
) 4 M X q |
*+,-./0123 NOPQRSTUVW rstuvwxyz{