itertools.combinations_with_replacement()

Sort by

recency

|

528 Discussions

|

  • + 0 comments
    from itertools import combinations_with_replacement
    S, k = input().split()
    for c in combinations_with_replacement(sorted(S), int(k)):
        print(''.join(c))
    
  • + 0 comments

    from itertools import combinations_with_replacement

    s,k=input().split() k=int(k)

    s=sorted(s)

    for comb in combinations_with_replacement(s,k): print("".join(comb))

  • + 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))]

  • + 0 comments
    from itertools import combinations_with_replacement
    s, n = input().split(" ")
    [print(''.join(x)) for x in (combinations_with_replacement(sorted(s),int(n)))]
    
  • + 0 comments
    from itertools import combinations_with_replacement as cwr
    
    S, k = input().split()
    merged = cwr(sorted(S), int(k))
    
    for i in merged:
            print(''.join(i))