시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 512 MB61343156.364%

문제

Do you wanna build a snowman? Of course, you do! And you finally have enough snow on the walk in front of your house. But you see that snow on different sections of the walkway has different quality: on some sections, snow is good, white and sticky, let's say, such sections are class a sections, other sections with a bit worse quality would have class b, for even worse quality --- class c and so on.

To build a base for a snowman you should roll a snowball forward or backward from one track section to another. There is enough snow, so you can go back to the same section as many times as you want.  Of course, you want to build a snowman out of the best snow, and the closer to the centre of the snowball, the more important the quality of snow for the future snowman, so at the beginning of the building process you should choose the best sections. For example, if you roll a snowball starting on section with class c, then on section a, and then on section b (cab), it would not be as solid as the bab ball, and the aca snowball would be even better.

Classes of track sections are written in the string $s$. To make the first ball, you need to roll it through the track sections $k$ times. You can start to roll a ball for the snowman at any section of the track. What sequence of sections should be used to get the most solid ball?

입력

The first line contains the string $s$ of lowercase letters --- track sections classes. The number of sections is not less than 2 and not greater than 100.

The second line contains one integer $k$ ($1 \le k \le 10^4$) --- the number of sections for the snowball. 

출력

Print the sequence of letters without spaces --- section classes in the order you will roll the ball.

서브태스크

번호배점제한
111

$|s| = 2$, $k \le 15$

217

$|s| \le 3$, $k \le 15$

319

$|s| \le 100$, $k \le 15$

424

$|s| \le 26$, $k \le 10^4$, all letters in $s$ are different

529

$|s| \le 100$, $k \le 10^4$

예제 입력 1

dcabe
3

예제 출력 1

aba

예제 입력 2

bbb
5

예제 출력 2

bbbbb

채점 및 기타 정보

  • 예제는 채점하지 않는다.