haju__log

[python][SWEA][D3] 10804. 문자열의 거울상 본문

SWEA

[python][SWEA][D3] 10804. 문자열의 거울상

haju 2023. 5. 12. 14:17

https://swexpertacademy.com/main/code/problem/problemDetail.do?problemLevel=2&problemLevel=3&contestProbId=AXTC0x16D8EDFASe&categoryId=AXTC0x16D8EDFASe&categoryType=CODE&problemTitle=&orderBy=PASS_RATE&selectCodeLang=PYTHON&select-1=3&pageSize=10&pageIndex=4 

 

SW Expert Academy

SW 프로그래밍 역량 강화에 도움이 되는 다양한 학습 컨텐츠를 확인하세요!

swexpertacademy.com

 

T=int(input())

for test_case in range(1,T+1):
    s=list(input())
    for i in range(len(s)):
        if s[i]=='b':
            s[i]='d'
        elif s[i]=='d':
            s[i]='b'
        elif s[i]=='p':
            s[i]='q'
        else:
            s[i]='p'
    s.reverse()
    s=''.join(s)
    print("#%d %s" %(test_case,s))