from itertools import permutations
import re
def regex_pattern(input_string):
return re.compile(input_string.replace("*", ".{1}"))
def solution(user_id, banned_id):
answer = []
count = 0
banned_id = list(map(regex_pattern, banned_id))
for case in permutations(user_id, len(banned_id)):
for c, b in zip(case, banned_id):
if not b.fullmatch(c):
break
else:
answer.append(tuple(sorted(case)))
return len(set(answer))
'PS > 브루트포스' 카테고리의 다른 글
[백준] No.19942 다이어트 完 (0) | 2023.12.05 |
---|---|
[프로그래머스] No.64064 불량 사용자 01 (0) | 2023.11.20 |
[프로그래머스] No.72411 메뉴 리뉴얼 完 (0) | 2023.10.07 |
[프로그래머스] No.72411 메뉴 리뉴얼 01 (0) | 2023.10.07 |
[백준] No.20529 가장 가까운 세 사람의 심리적 거리 完 (0) | 2023.08.04 |