Score : 1300 points
Takahashi has a string S of length N consisting of lowercase English letters. On this string, he will perform the following operation K times:
Among the strings that can be the string S after the K operations, find the lexicographically smallest possible one.
Input is given from Standard Input in the following format:
N K S
Print the lexicographically smallest possible string that can be the string S after the K operations.
5 1 bacba
aabca
When S=bacba
, T=abcab
, U=bacbaabcab
, and the optimal choice of S' is S'=aabca
.
10 2 bbaabbbaab
aaaabbaabb