itertools.combinations_with_replacement()

  • + 0 comments

    from itertools import combinations_with_replacement

    string,k = input().split()

    [print(*i,sep="") for i in combinations_with_replacement(sorted(string),int(k))]