We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
itertools.combinations()
itertools.combinations()
Sort by
recency
|
885 Discussions
|
Please Login in order to post a comment
from itertools import combinations
st = input().split()
s = st[0]
k = int(st[1])
sorted_string = sorted(s)
for i in range(1, k+1):
for combo in combinations(sorted_string, i):
from itertools import combinations
a, b = input().split()
a =sorted(str(a))
A = []
x = int(b) for i in range(1, int(b)+1): A.append(list(combinations(a, i))) x += i
for j in range(int(b)): for i in range(len(A[j])): print(''.join(A[j][i]))
from itertools import combinations
def combine(s, k): for i in range(1, k+1): var = list(combinations(s, i)) [print(''.join(x)) for x in var]
s, k = input().split() s = list(s.upper()) # s determined as list s.sort() combine(s, int(k))