- Notifications
You must be signed in to change notification settings - Fork 846
/
Copy path9.py
19 lines (16 loc) · 671 Bytes
/
9.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
fromitertoolsimportcombinations
vowels= ('a', 'e', 'i', 'o', 'u') # 5개의 모음 정의
l, c=map(int, input().split(' '))
# 가능한 암호를 사전식으로 출력해야 하므로 입력 이후에 정렬 수행
array=input().split(' ')
array.sort()
# 길이가 l인 모든 암호 조합을 확인
forpasswordincombinations(array, l):
# 패스워드에 포함된 각 문자를 확인하며 모음의 개수를 세기
count=0
foriinpassword:
ifiinvowels:
count+=1
# 최소 1개의 모음과 최소 2개의 자음이 있는 경우 출력
ifcount>=1andcount<=l-2:
print(''.join(password))