use std::io::Read; fn main() { let mut s = String::new(); std::io::stdin().read_to_string(&mut s).ok(); let n: Vec = s.split_whitespace().flat_map(str::parse).collect(); let s = s.lines().last().unwrap(); println!( "{}{}", &s[n[1] - 1..], if (n[0] - n[1]) % 2 == 0 { s[..n[1] - 1].chars().rev().collect::<_>() } else { s[..n[1] - 1].to_owned() } ); }