-Code
mirror = ['b', 'd', 'p', 'q', 'i', 'o', 'v', 'w', 'x']
dic = {'b':'d', 'd':'b', 'p':'q', 'q':'p'}
while 1:
s = input()
result = ""
if s == '#':
break
for i in s:
if i not in mirror:
result = "INVALID"[::-1]
break
if i in dic:
result += dic[i]
else:
result += i
print(result[::-1])
'Beakjoon&프로그래머스 > 파이썬' 카테고리의 다른 글
[백준/파이썬] 4740번 거울, 오! 거울 (0) | 2022.08.06 |
---|---|
[백준/파이썬] 4597번 패리티 (0) | 2022.08.05 |
[백준/파이썬] 4447번 좋은놈 나쁜놈 (0) | 2022.08.03 |
[백준/파이썬] 25286번 11월 11일 (0) | 2022.08.02 |
[백준/파이썬] 25285번 심준의 병역판정검사 (0) | 2022.08.01 |