#include using namespace std; int main() { int n, k; cin >> n >> k; string s; cin >> s; for (int i = 0; i < n - k + 1; i++) { //cout << i << endl; string s_f, s_m, s_b; s_f = s.substr(0, i); s_m = s.substr(i, k); s_b = s.substr(i + k, n - i - k); reverse(s_m.begin(), s_m.end()); s = s_f + s_m + s_b; //cout << s_f << ":" << s_m << ":" << s_b << endl; //cout << s << endl; } cout << s << endl; }