반응형
SMALL

itertools.permutations() 

더보기

Explanation

All possible size 2  permutations of the string "HACK" are printed in lexicographic sorted order.

주어진 문자열을 받아서

문자 2가지 씩 뽑는 경우

(오름차순으로 정렬)

# # Enter your code here. Read input from STDIN. Print output to STDOUT
from itertools import permutations
s, n = input().split()
for i in permutations(sorted(s), int(n)):
	print(''.join(i))
from itertools import permutations
s, n = input().split()
print("\n".join(list(map(''.join, permutations(sorted(s), int(n))))))

 

 

반응형
LIST

+ Recent posts