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
|
898 Discussions
|
Please Login in order to post a comment
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))
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)]