def is_valid(password):
vowels = set('aeiou')
num_vowels = sum(1 for char in password if char in vowels)
num_consonants = len(password) - num_vowels
return num_vowels >= 1 and num_consonants >= 2
def backtrack(start, path):
if len(path) == L:
if is_valid(path):
print(''.join(path))
return
for i in range(start, C):
path.append(chars[i])
backtrack(i + 1, path)
path.pop()
# 입력 받기
L, C = map(int, input().split())
chars = input().split()
chars.sort()
# 백트래킹 시작
backtrack(0, [])
카테고리 없음