defmodule Main do def main do [n, k] = IO.read(:line) |> String.trim() |> String.split() |> Enum.map(&String.to_integer/1) IO.read(:line) |> String.trim() |> solve(n, k) |> IO.puts() end def solve(s, n, k) do {a, b} = s |> String.split_at(k - 1) b <> if (n - k) |> rem(2) == 0, do: a |> String.reverse(), else: a end end