#C. C - One More aab aba baa

    传统题 1000ms 256MiB

C - One More aab aba baa

该比赛已结束,您无法在比赛模式下递交该题目。您可以点击“在题库中打开”以普通模式查看和递交本题。

C - One More aab aba baa

Score : $300$ points

Problem Statement

Find the $K$-th lexicographically smallest string among the strings that are permutations of a string $S$.

What 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$.

Constraints

  • $1 \le |S| \le 8$
  • $S$ consists of lowercase English letters.
  • There are at least $K$ distinct strings that are permutations of $S$.

Input

Input is given from Standard Input in the following format:

SS KK

Output

Print the answer.


aab 2
aba

There are three permutations of a string aab: $\{$ aab, aba, baa $\}$. The $2$-nd lexicographically smallest of them is aba.


baba 4
baab

ydxwacbz 40320
zyxwdcba

2024寒假入门组刷题营(十三)

未参加
状态
已结束
规则
ACM/ICPC
题目
8
开始于
2024-2-13 13:30
结束于
2024-2-13 15:30
持续时间
2 小时
主持人
参赛人数
10