#![allow(unused_imports)] #![allow(non_snake_case)] use std::cmp::*; use std::collections::*; use std::io::Write; #[allow(unused_macros)] macro_rules! debug { ($($e:expr),*) => { #[cfg(debug_assertions)] $({ let (e, mut err) = (stringify!($e), std::io::stderr()); writeln!(err, "{} = {:?}", e, $e).unwrap() })* }; } fn main() { let v = read_vec::(); let (n, k) = (v[0], v[1]); let s = read::().chars().collect::>(); let mut ans = (k - 1..n).map(|i| s[i]).collect::>(); if (n - k + 1) % 2 == 0 { for i in 0..k - 1 { ans.push(s[i]); } } else { for i in (0..k - 1).rev() { ans.push(s[i]); } } let ans = ans.iter().collect::(); println!("{}", ans); } fn read() -> T { let mut s = String::new(); std::io::stdin().read_line(&mut s).ok(); s.trim().parse().ok().unwrap() } fn read_vec() -> Vec { read::() .split_whitespace() .map(|e| e.parse().ok().unwrap()) .collect() }