P28034 [洛谷] [SHUPC 2024] Rail Fence Cipher
普及+
题目描述

Problem Description

The rail fence cipher is a basic type of transposition cipher.

We arrange the plaintext Hello,World! as follows:

H...o...r
.e.l.,.o.l.!
..l...W...d

This means arranging the plaintext Hello,World! into a shape of several \/\/\/ patterns, and then extracting characters row by row from left to right to form the ciphertext. For example, the first row is Hor, the second row is el,ol!, the third row is lWd, and the final ciphertext is Horel,ol!lWd.

If the ciphertext arranged in this way has $h$ rows, we call the height of the rail fence cipher $h$.

Now, given the height $h$ and a ciphertext string $s$, please output a plaintext string $plain$.

Input Format

The first line contains a number $h\ (2\le h \le10)$, representing the height of the cipher.

The second line contains a string $s\ (1\le |s| \le 10^5)$, representing the ciphertext.

Output Format

A string $plain$, representing the plaintext.

Sample Input and Output

Sample Input #1

3
Horel,ol!lWd

Sample Output #1

Hello,World!

Sample Input #2

5
ccehgyaefnpeoobe{lcirg}epriec_ora_g

Sample Output #2

cyberpeace{railfence_cipher_gogogo}
输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
3 Horel,ol!lWd
样例输出
Hello,World!