{"raw_statement":[{"iden":"problem statement","content":"Find the $K$\\-th lexicographically smallest string among the strings that are permutations of a string $S$.\nWhat is a permutation of a string?A string $A$ is said to be a permutation of a string $B$ when any character occurs the same number of times in $A$ and $B$."},{"iden":"constraints","content":"*   $1 \\le |S| \\le 8$\n*   $S$ consists of lowercase English letters.\n*   There are at least $K$ distinct strings that are permutations of $S$."},{"iden":"input","content":"Input is given from Standard Input in the following format:\n\n$S$ $K$"},{"iden":"sample input 1","content":"aab 2"},{"iden":"sample output 1","content":"aba\n\nThere are three permutations of a string `aab`: ${$ `aab`, `aba`, `baa` $}$. The $2$\\-nd lexicographically smallest of them is `aba`."},{"iden":"sample input 2","content":"baba 4"},{"iden":"sample output 2","content":"baab"},{"iden":"sample input 3","content":"ydxwacbz 40320"},{"iden":"sample output 3","content":"zyxwdcba"}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}