Skip to content

Commit 8a844e1

Browse files
authored
Create 9.py
1 parent 094a520 commit 8a844e1

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

20/9.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
from itertools import combinations
2+
3+
vowels = ('a', 'e', 'i', 'o', 'u') # 5개의 모음 정의
4+
l, c = map(int, input().split(' '))
5+
6+
# 가능한 암호를 사전식으로 출력해야 하므로 입력 이후에 정렬 수행
7+
array = input().split(' ')
8+
array.sort()
9+
10+
# 길이가 l인 모든 암호 조합을 확인
11+
for password in combinations(array, l):
12+
# 패스워드에 포함된 각 문자를 확인하며 모음의 개수를 세기
13+
count = 0
14+
for i in password:
15+
if i in vowels:
16+
count += 1
17+
# 최소 1개의 모음과 최소 2개의 자음이 있는 경우 출력
18+
if count >= 1 and count <= l - 2:
19+
print(''.join(password))

0 commit comments

Comments
 (0)