itertools.permutations()

  • + 0 comments

    from itertools import permutations

    s,n = input().split() n = int(n) result = sorted(list(permutations(s,n)))

    for i in result: print(''.join(i))