itertools.combinations_with_replacement()

  • + 0 comments

    from itertools import combinations_with_replacement s, k = input().split() l = list(combinations_with_replacement(sorted(s),int(k))) for item in l: print(''.join(item))