Alphabetically smallest word

Given a string ss made up of only lowercase letters, and a natural number kk, remove any substring of length kk from ss so that the result is the lexicographically smallest possible word.

Input

Input consists of several cases, each with ss and kk. Assume 1k<|s|1041 \le k < \vert s \vert \le 10^4.

Output

For every case, print the alphabetically smallest word that can be obtained after removing kk consecutive letters from ss.

Problem information

Author: Salvador Roura

Generation: 2026-01-25T12:01:57.312Z

© Jutge.org, 2006–2026.
https://jutge.org