#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 -th from the end”, “the -th”, etc. all refer to the word before the change):
- The last letter is moved to between the -st and -nd letters.
- The second-to-last letter is moved to between the -nd and -rd letters.
- The -th letter from the end is moved to between the -th and -th letters.
For example, the word will become after he blinks.
If Martin blinks again, the same thing will happen again.
Given the number of times Martin blinks and the word that he sees, find the original word.
Input Format
The first line contains an integer , representing the number of times Martin blinks.
The second line contains a string , 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: .
Constraints
- For of the testdata, .
- For of the testdata, , .
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 points.
Translated by ChatGPT 5
京公网安备 11011102002149号