본문 바로가기
Beakjoon&프로그래머스/파이썬

[백준/파이썬] 27058번 Message Decowding

by 현장 2024. 5. 28.

-Code

key = input()
message = input()
res = ""

for w in message:
    if w.isalpha():
        if w.isupper() and w.lower() in key:
            res += key[ord(w.lower()) - 97].upper()
        else:
            res += key[ord(w) - 97]
    else:
        res += w

print(res)