itertools.permutations()

  • + 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))