Problem list
Log in
#icpc00224 · ICPC NWERC 2024

Evolving Etymology

Gold IV 1.0 s 2048 MB

Eelco has recently started to gain interest in the field that studies the origin of words: etymology. He especially likes how words can evolve in many different ways: pronunciation changes over time, words are borrowed from different languages, and the meaning of words can change based on culture. Eelco is eager to attend the Networking With Etymologists: Revolutionary Conference for the first time ever. To make a good first impression, he is going to present a completely new method to make new words from existing words.

To make a new word from an existing word $s$, Eelco proposes to take every second letter of $s+s$, starting with the first letter. For example, applying this method to the word "etymology" would result in "eyooytmlg". Of course, to design even more words, this process can be repeated many times. Eelco would like to prepare a list of new words to present at the conference, so he writes a program that applies his method some predetermined number of times.

Input

The input consists of:

  • One line with two integers $n$ and $k$ ($1 \leq n \leq 10^5$, $1 \leq k \leq 10^{18}$), the length of the original word and the number of times to apply the method.
  • One line with a string $s$ of length $n$, only consisting of English lowercase letters (a-z), the original word.

Output

Output the resulting word after applying the method to the original word $k$ times.

Example 1

Input
9 1
etymology
Output
eyooytmlg

Example 2

Input
4 1
word
Output
wrwr

Example 3

Input
5 1000000000000000000
delft
Output
delft

Example 4

Input
5 5
eceol
Output
eelco
Source
ICPC NWERC 2024
Appears in
Not part of a ladder, contest or set yet.
Accepted 0 Submissions 0 Acceptance 0% Solvers 0

Discussion

Threads about this problem. Spoilers are collapsed; wrap hints in ||double bars||.

No discussion yet. Start a thread if something here needs explaining.

Recent submissions Open with filters
Code