itertools.permutations()

Sort by

recency

|

908 Discussions

|

  • + 0 comments

    Here is the solution:

    from itertools import permutations s,k = input().split() res = sorted(permutations(s,int(k))) for i in res: print("".join(i))

  • + 0 comments

    from itertools import permutations s,k=input().split() k=int(k) result=sorted(permutations(s,k)) for perm in result: print("".join(perm))

  • + 0 comments

    from itertools import permutations string, k= input().split() [print(*i , sep="") for i in list(permutations(sorted(string),int(k)))]

  • + 0 comments
    # Enter your code here. Read input from STDIN. Print output to STDOUT
    import itertools
    
    S, k = input().split()
    permutations = list(itertools.permutations(S, int(k)))
    lexico_s = sorted(permutations)
    for case in lexico_s:
        print(''.join(case))
    
  • + 0 comments
    from itertools import permutations
    s, n = input().split(" ")
    [ print(''.join(x)) for  x in sorted(permutations(s,int(n)))]