itertools.combinations()

Sort by

recency

|

898 Discussions

|

  • + 0 comments
    from itertools import combinations
    
    if __name__ == '__main__':
        s, length = input().split()
        
        for i in range(1, int(length)+1):
            print('\n'.join([''.join(t) for t in combinations(sorted(s), i)]))
    
  • + 0 comments
    # Enter your code here. Read input from STDIN. Print output to STDOUT
    from itertools import combinations
    
    S = input().split()
    for i in range(1,int(S[1])+1):
        for l in combinations(sorted(S[0].upper()), i):
            print(''.join(l))
    
  • + 0 comments

    from itertools import combinations s,k=input().split() k=int(k)

    s=sorted(s) for i in range(1,k+1): for comb in combinations(s,i): print("".join(comb))

  • + 0 comments

    from itertools import combinations

    string,k = input().split()

    [[print(*i,sep="") for i in combinations(sorted(string),i)] for i in range(1,int(k)+1)]

  • + 0 comments
    from itertools import combinations
    s, n = input().split(" ")
    for i in range(1, int(n) + 1):
        [ print(''.join(x)) for  x in combinations(sorted(s),i)]