#include #include #include #include #include #include #include #include #include #include #include using namespace std; using ll = long long; using ld = long double; const ll MOD = 1000000000 + 7; const ll INF = 1e+9; const ld PI = acos((long double)(-1)); #define no "no" #define No "No" #define NO "NO" #define yes "yes" #define Yes "Yes" #define YES "YES" #define next '\n' #define sp " " #define print(x) cout << (x) << endl; #define rep(i, n) for(int (i) = (0); (i) < (n); (++i)) #define FOR(i, start, end) for(int (i) = (start); (i) < (end); (++i)) #define foreach(elem, _list) for(auto& (elem) : (_list)) #define view(_list) foreach(e, _list){ cout << e << sp; } cout << next #define FAST ios::sync_with_stdio(false); cin.tie(nullptr) #define size(s) (s).size() #define ALL(vec) (vec).begin(), (vec).end() #define pb(e) push_back(e) #define EPS 0.00000001 int main() { FAST; int n, k; string s; cin >> n >> k >> s; int len = n - k + 1; string t, u; for(int i = 0; i < len; ++i){ t += s[i]; } for(int i = len; i < n; ++i){ u += s[i]; } if((n - k) % 2 != 0){ reverse(ALL(t)); } print(t + u); }