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

[백준/파이썬] 10347번 Reverse Rot

by 현장 2024. 1. 7.

-Code

incoding = "ABCDEFGHIJKLMNOPQRSTUVWXYZ_."

while True:
    line = list(input().split())

    if line[0] == "0":
        break

    n = int(line[0])
    line = line[1]
    res = ""

    for w in line:
        p = (incoding.index(w) + n) % len(incoding)
        res += incoding[p]

    print(res[::-1])