시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
2 초 | 512 MB | 168 | 99 | 87 | 58.389% |
You are playing a game which involves drawing and redrawing a string on a blackboard. You start with a string S of length N and perform a switcheroo on the string exactly K times. A switcheroo involves breaking S into quarters, and then moving the middle two quarters to the end of S without changing their relative order to each other. For example, say you start with aabbccdd. After a single switcheroo, the string would become aaddbbcc. After another switcheroo, you would have aaccddbb, and so on.
Given some starting string S and the number of times you should perform a switcheroo, what is the final state of the string?
The input starts with a line containing two integers N (4 ≤ N ≤ 100 000), which is the length of the string, and K (1 ≤ K ≤ 1018), which is the number of times you should perform a switcheroo to S. It is guaranteed that N is a multiple of 4.
The second line contains S. The string S contains only lowercase letters and consists of exactly N characters.
Display the string after performing K switcheroos.
4 2 abcd
acdb
8 1 abcdefgh
abghcdef
20 26 southpacificregional
southicregionalpacif