forked from ndb796/python-for-coding-test
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path9.py
More file actions
19 lines (16 loc) Β· 671 Bytes
/
9.py
File metadata and controls
19 lines (16 loc) Β· 671 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
from itertools import combinations
vowels = ('a', 'e', 'i', 'o', 'u') # 5κ°μ λͺ¨μ μ μ
l, c = map(int, input().split(' '))
# κ°λ₯ν μνΈλ₯Ό μ¬μ μμΌλ‘ μΆλ ₯ν΄μΌ νλ―λ‘ μ
λ ₯ μ΄νμ μ λ ¬ μν
array = input().split(' ')
array.sort()
# κΈΈμ΄κ° lμΈ λͺ¨λ μνΈ μ‘°ν©μ νμΈ
for password in combinations(array, l):
# ν¨μ€μλμ ν¬ν¨λ κ° λ¬Έμλ₯Ό νμΈνλ©° λͺ¨μμ κ°μλ₯Ό μΈκΈ°
count = 0
for i in password:
if i in vowels:
count += 1
# μ΅μ 1κ°μ λͺ¨μκ³Ό μ΅μ 2κ°μ μμμ΄ μλ κ²½μ° μΆλ ₯
if count >= 1 and count <= l - 2:
print(''.join(password))