지나가던 개발자
[Python] 백준 14584번(암호 해독) 문제 풀이 본문
from string import ascii_lowercase
alphabets = list(ascii_lowercase)
s = input()
dictionary = []
for i in range(int(input())):
dictionary.append(input())
printed = False
for i in dictionary:
if i in s:
print(s)
printed = True
break
if not printed:
for i in range(1, 26):
alpha = {}
for j in range(26):
a = j+i
if a > 25:
a -= 26
alpha[alphabets[j]] = alphabets[a]
decode = ""
for j in s:
decode += alpha[j]
for j in dictionary:
if j in decode:
print(decode)
break
'PS > Python' 카테고리의 다른 글
[Python] 백준 14490번(백대열) 문제 풀이 (0) | 2022.11.10 |
---|---|
[Python] 백준 5426번(비밀 편지) 문제 풀이 (0) | 2022.11.10 |
[Python] 백준 25325번(학생 인기도 측정) 문제 풀이 (0) | 2022.11.08 |
[Python] 백준 2196번((중략)) 문제 풀이 (0) | 2022.11.08 |
[Python] 백준 15904번(UCPC는 무엇의 약자일까?) 문제 풀이 (0) | 2022.11.07 |
Comments