Hide

Problem F
Periodic Encryption

A new form of secure data transfer has been developed, but it is so time consuming to do manually. The protocol is named “periodic encryption”, you begin with an $n$ length string and an encryption factor $k$, the encrypted output is formed by repeatedly taking the $k$-th character counting from the previously taken character until the input string is empty. To begin you start counting from the first character of the string. If you reach the end of the string, continue counting from the beginning.

Input

The first line of input contains two space seperated integers, the length of the input string $1 \leq n \leq 100$, and the encryption factor $1 \leq k \leq 100$.

The second line of input contains an $n$ length string consisting only of letters from the lowercase english alphabet.

Output

Output a single line containing the encrypted string.

Sample Input 1 Sample Output 1
4 3
caup
uapc
Sample Input 2 Sample Output 2
9 5
neyrepcdt
encrypted
Sample Input 3 Sample Output 3
3 8
fof
off

Please log in to submit a solution to this problem

Log in