fun main(args: Array) = p1020() fun p1020() { val (n, k) = readLine()!!.split(' ').map { it.toInt() } val s = readLine()!!.toCharArray() for (i in 0..n - k) { val slice = s.slice(i until i + k).reversed() for (j in i until i + k) { s[j] = slice[j - i] } } val answer = s.joinToString("") println(answer) }