📅  最后修改于: 2022-03-11 14:51:26.489000             🧑  作者: Mango
from itertools import combinations_with_replacement
s, k = input().split()
for c in combinations_with_replacement(sorted(s), int(k)):
print("".join(c))