#P7750. [COCI 2013/2014 #2] SLOM

[COCI 2013/2014 #2] SLOM

Description

Martin has something wrong with his eyes.

For a word, each time he blinks, the letters of the word change in his eyes as follows (the phrases “the kk-th from the end”, “the kk-th”, etc. all refer to the word before the change):

  • The last letter is moved to between the 11-st and 22-nd letters.
  • The second-to-last letter is moved to between the 22-nd and 33-rd letters.
  •  \ldots\ \ldots
  • The kk-th letter from the end is moved to between the kk-th and (k+1)(k+1)-th letters.

For example, the word abcdef\tt abcdef will become afbecd\tt afbecd after he blinks.

If Martin blinks again, the same thing will happen again.

Given the number of times Martin blinks XX and the word ss that he sees, find the original word.

Input Format

The first line contains an integer XX, representing the number of times Martin blinks.

The second line contains a string ss, representing the word Martin sees.

Output Format

Output one line with one string: the original word.

4 
acefdb
abcdef
1000 
aaaaaa
aaaaaa
11 
srama
sarma

Hint

Explanation for Sample 1

The transformation process is: abcdefafbecdadfcbeaedbfcacefdb\tt abcdef\to afbecd\to adfcbe\to aedbfc\to acefdb.

Constraints

  • For 50%50\% of the testdata, 1X1001\le X\le 100.
  • For 100%100\% of the testdata, 1X1091\le X\le 10^9, 3s1033\le |s|\le 10^3.

Source

This problem is translated from COCI2013-2014 CONTEST 2 T3 SLOM.

According to the original testdata settings, the full score for this problem is 100100 points.

Translated by ChatGPT 5