icpc probs

This commit is contained in:
Barrett Ruth 2026-01-07 12:30:51 -06:00
parent 4c531b965f
commit 69d48861b1
17 changed files with 448 additions and 2 deletions

View file

@ -0,0 +1,22 @@
ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZ_."
character_to_index = {c: i for i, c in enumerate(ALPHABET)}
index_to_character = {i: c for i, c in enumerate(ALPHABET)}
while line := input():
split = line.split()
if len(split) == 1:
break
k, string = int(split[0]), split[1]
backwards = string[::-1]
ans: list[str] = []
for letter in backwards:
index = character_to_index[letter]
ans.append(index_to_character[(index + k) % len(ALPHABET)])
print("".join(ans))