あなたの仕事は、数字と文字列を与えられた文字列をそのサイズのチャンクに分割し、それらを逆にするプログラムを書くことです。
ルール
プログラムは、正の整数とn
、s
印刷可能なASCIIのみ(空白を含まない)で構成される長さ少なくとも1つの文字列を受け取ります。文字列n
の長さがn
残りの部分で割り切れない場合、文字列はlengthのチャンクに分割される必要があります。次に、チャンクの順序を逆にして、再びまとめます。
テストケース
n s Output
2 abcdefgh ghefcdab
3 foobarbaz bazbarfoo
3 abcdefgh ghdefabc
2 a a
1 abcdefgh hgfedcba
2 aaaaaa aaaaaa
2 baaaab abaaba
50 abcdefgh abcdefgh
6 abcdefghi ghiabcdef
これはcode-golfなので、できるだけ少ないバイトを目指してください。