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.permutations()
itertools.permutations()
+ 0 comments from itertools import permutations
s, k = input().split()
out = list(map(lambda x: "".join(x), list(permutations(s, int(k)))))
out.sort()
print(*out, sep="\n")
+ 0 comments Very pythonic but not very readable
from itertools import permutations s,k = input().split() print('\n'.join(sorted([''.join(i) for i in permutations(s,int(k))])))
+ 0 comments from itertools import permutations S,k= input().split() li=list(permutations(S,int(k))) for i in sorted(li): print("".join(i))
+ 0 comments from itertools import permutations A=input().split() l=A[0] r=int(A[1]) f=sorted(list(permutations(l,r))) for _ in f: print("".join(_))
+ 0 comments Enter your code here. Read input from STDIN. Print output to STDOUT
from itertools import permutations
input1 = input().split() string = input1[0] n = int(input1[1]) perms = sorted([''.join(perm) for perm in permutations(string, n)])
for perm in perms: print(perm)
Load more conversations
Sort 723 Discussions, By:
Please Login in order to post a comment