Skip to content

Instantly share code, notes, and snippets.

@washingtonsoares
Created May 11, 2022 08:59
Show Gist options
  • Save washingtonsoares/9a7c1d70ee6e2b68bbe4dfc3f7af80f1 to your computer and use it in GitHub Desktop.
Save washingtonsoares/9a7c1d70ee6e2b68bbe4dfc3f7af80f1 to your computer and use it in GitHub Desktop.
# https://www.beecrowd.com.br/judge/pt/problems/view/1024
n = int(input())
for _ in range(n):
text = input()
text2 = ""
# first step
for char in text:
if (char.isalpha()):
text2 += chr(ord(char) + 3)
else:
text2 += char
# second step
text3 = text2[::-1]
# third step
text4 = ""
first_half = text3[:len(text3)//2]
second_half = text3[len(text3)//2:]
for char in second_half:
text4 += chr(ord(char) - 1)
print(first_half, end='')
print(text4)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment