Mirror Alphabet Code

The Atbash cipher replaces letters as if the alphabet were mirrored: the first letter becomes the last, the second becomes the second-to-last, and so on. The function encode receives a string plain, converts letters to lowercase, and replaces them using the rule az, by. Digits stay unchanged, and the final encoded text should be grouped into blocks of 5 characters.

Примеры

Ввод
"yes"
Вывод
"bvh"
Ввод
"no"
Вывод
"ml"
Ввод
"OMG"
Вывод
"lnt"

Нужно реализовать

def encode(plain: str) -> str:

Теги

strings
PostgreSQLv16

Här visas resultatet av din kod

Visible tests
1
Input
"yes"
Expected"bvh"
2
Input
"no"
Expected"ml"
3
Input
"OMG"
Expected"lnt"
4
Input
"mindblowingly"
Expected"nrmwy oldrm tob"
5
Input
"Testing,1 2 3, testing."
Expected"gvhgr mt123 gvhgr mt"
6
Input
"ab"
Expected"zy"
Focus radio
Paused · SomaFM · Fluid